Understanding supported code inputs

To get started, you will first need to know what inputs are supported for creating the advanced pattern code.

All pattern creations must start with the context designation [[<context name>]].

The following inputs are available when the policy code is invoked:

Input Type Description Example
BG.domain string domain of a HTTP request www.google.com
BG.method string HTTP method name (PUT, POST, GET, etc.) POST
BG.uri string URI of request /search
BG.qs string query string of request x=1&y=%2Es&z=
BG.cookie string request cookie k1=v1; k2=v2

The following Lua libraries are available in this context:

Library Description
string Standard Lua string matching library.

At the end of the computation, items stored are interpreted as follows:

Output Type Default Value Interpretation
BGResult.match integer 0 A non-zero value indicates that the condition represented by this Advanced Policy is satisfied.
BGResult.log string nil Any text specified here will be logged

Callbacks are also available to reference and accepts a table as input and returns a boolean (true/false) value:

Callback Description
BG.MatchFormFields Processes fields in application/x-www-form-urlencoded, application/json or multipart/form-data post bodies.