Common Handlers
revIgniter uses a few handlers for its operation that are available to you at any point. These do not require loading any libraries or helpers.
rigFetchConfigItem("Item", "Index")
The Config library is the preferred way of accessing configuration information, however rigFetchConfigItem() can be used to retrieve single keys. See Config library documentation for more information.
rigShowError "message"
rigShow404 "page"
rigLogMessage "level", "message"
rigDoException contexts, "currentFile", "currentHandler"
These are each outlined on the Error Handling page.
rigSetStatusHeader code, "text"
Permits you to manually set a server status header. Example:
rigSetStatusHeader 401
# Sets the header as: Unauthorized
See here for a full list of headers.
rigNonce()
Generates a random string unique for each request as used by Content Security Policy response headers.
Example on generating a CSP meta tag:
put "'nonce-" & rigNonce() & "'" into tSrcNonce
# GENERATE A Content Security Policy META TAG TO BE USED IN THE HEADER
rigLoadHelper "html"
put "Content-Security-Policy" into tCspMetaA["name"]
put "style-src 'self'" && tSrcNonce into tCspMetaA["content"]
put "equiv" into tCspMetaA["type"]
put rigHtmlMeta(tCspMetaA) into gData["cspTag"]
Add csp nonce to your view file.
[[gData["cspTag"]]] <!-- see above -->
<style nonce="<? return rigNonce() ?>" type="text/css">
body {
...
}
...
</style>
Note: The preferred mechanism to deliver CSP is an HTTP header. Furthermore there are directives the meta tag can't be used for, like frame-ancestors, sandbox or report-uri. So, you should consider using the Content Security Policy library, which also makes it easier to set up a CSP. See Content Security Policy library documentation for more information.