Akamai EdgeWorker v4 configuration options

Each Enforcer has a set of configuration options that control the Enforcer’s functionality and features. While some are required, many of these are optional configurations that you can use to customize the Enforcer’s behavior. You can reference available configurations with this article. You can add and maintain configurations with Akamai Property Manager variables.

While all Enforcers come with the same set of required configurations, the optional configurations available for each may differ. We recommend updating to the latest Enforcer version to ensure you have access to the latest features and configurations.

Every variable will always precede with PMUSER_ (i.e. PX_APP_ID becomes PMUSER_PX_APP_ID). Akamai Property rules reference the Akamai Property variables dynamically whenever possible. However, sometimes changes to the Akamai Property variables also need changes to the Akamai Property rules, such as for PX_APP_ID and PX_FILTER_BY_EXTENSION. Be sure to double-check the Property rules when making variable changes to ensure they are aligned.

Deployment

Whenever you update the Enforcer’s configuration, you must rebuild the Worker for the changes to take effect. To do so:

  1. Run npm run build:worker.
  2. Upload and activate the newly generated bundle.

Custom functions must be implemented directly within the Akamai EdgeWorker code in example/src/customFunctions.ts or equivalent source file used for bundling.

Quick reference

Feature nameKeyTypeDefaultDescription
Application IDPX_APP_IDString""HUMAN Application ID
Authentication tokenPX_AUTH_TOKENString""HUMAN authentication token
Cookie secretPX_COOKIE_SECRETString""HUMAN cookie secret
Backend domainPX_BACKEND_DOMAINStringsapi-<PX_APP_ID>.perimeterx.netDomain to which HUMAN requests are sent
S2S timeoutPX_S2S_TIMEOUTInteger1000Total time, in milliseconds, that the Enforcer will wait for the Risk API request to return before timing out and passing the request

Required configurations

These configurations are necessary for the Enforcer’s basic functionality and features.

Basic functionality configurations

PX_APP_ID
stringRequired

Your HUMAN Application ID in the form of PX12AB34CD. You can copy this value from the HUMAN Console in Platform Settings > Applications Overview. If you have multiple applications, make sure to copy the ID of the application you want the Enforcer on.

PX_AUTH_TOKEN
stringRequired

Security Settings: Hidden

The application’s server token needed to authorize with HUMAN’s backend. You can copy this value from the HUMAN Console in Platform Settings > Applications Overview > Click the appropriate application > Server token tab.

stringRequired

Security Settings: Hidden

The secret used to encrypt and decrypt the risk cookie sent from the HUMAN Sensor. You can copy this value from the HUMAN Console in Sightline Cyberfraud Defense > Traffic Policy Overview > Click the appropriate application > Click the key > Copy value.

If you need to rotate secrets, then adjust this configuration to be an array of strings (string[]) and include the new secret and old secret. The new secret value should be the first value in the array. This prevents decryption failures. For example, newCooki3Secr3t,0ldCooki3Secr3t.

PX_BACKEND_DOMAIN
stringDefaults to sapi-<PX_APP_ID>.perimeterx.netRequired

Base URL for HUMAN SAPI (Risk API and related calls). If empty, the Enforcer uses the default host for your Application ID. Set this only when directed by HUMAN (for example, custom routing or non-standard environments). Update <PX_APP_ID> with your Application ID. For example, sapi-PX12345678.perimeterx.net.

PX_S2S_TIMEOUT
integerDefaults to 1000Required

The total time in milliseconds that the Enforcer will wait for the Risk API request to return before timing out and passing the request.

Basic feature configurations

PX_LOGGER_SEVERITY
"none" | "error" | "debug"Defaults to "error"Required

The severity at which the logger will output logs.

  • none: The logger will not generate any logs.
  • error: The logger will only generate logs on fatal errors.
  • debug: The logger will generate detailed logs for debugging purposes. Not recommended for production environments.

See PX_LOGGER_AUTH_TOKEN for a header-based alternative.

PX_IP_HEADERS
stringDefaults to emptyRequired

An array of header names that are trusted to contain the true client IP. Headers are traversed in the order they’re listed, and the first header value will always be used as the client IP.

Taken from AK_CLIENT_REAL_IP variable by default.

For example, true-ip,true-client-ip.

PX_MODULE_ENABLED
booleanDefaults to trueRequired

Whether the Enforcer module is enabled.

  • true: Enable the module
  • false: Disable the module
PX_MODULE_MODE
"monitor" | "active_blocking"Defaults to monitorRequired

The Enforcer’s operation mode.

  • monitor: The Enforcer performs all functions without returning block responses. Useful for analyzing and adjusting Enforcer behavior without serving block pages to end users. If you have routes that must have enforcement at all times, see Enforced routes.
  • active_blocking: The Enforcer will return block responses as needed.

Optional configurations

These configurations aren’t required, but you can use them to further customize the Enforcer’s behavior.

Advanced blocking response (ABR)

PX_ABR_ENABLED
booleanDefaults to true

In specific cases such as XHR post requests, a full CAPTCHA page render might not be an option. In such cases, the Advanced Blocking Response (ABR) returns a JSON object containing all the information needed to render a customized CAPTCHA challenge implementation such as a popup modal, a section on the page, etc. This provides more flexibility and customizability in displaying the CAPTCHA challenge.

  • true: Enable ABR
  • false: Disable ABR

Bypass monitor header

PX_BYPASS_MONITOR_HEADER
stringDefaults to x-px-block

Activates the full blocking flow to verify the flow works as expected if a particular header is present on the request. Often used during monitor mode, where the Enforcer collects data without blocking user requests, before switching to active_blocking.

Credentials Intelligence

These configurations let you extract and detect compromised credentials. They’re closely related to Credentials Intelligence-related features in Sightline Cyberfraud Defense.

At minimum, ensure the following are configured to enable Credential Intelligence:

PX_CI_EXTRACT_ENABLED
booleanDefaults to false

Whether to enable the extraction and reporting of credentials from the Enforcer for Credential Intelligence.

  • true: Enable Credential Intelligence
  • false: Disable Credential Intelligence
PX_CI_EXTRACT_DETAILS
object

The HumanSecurityFunctionsConfiguration object defined within the Akamai EdgeWorker code also includes a px_login_credentials_extraction field for defining login endpoints that require custom logic for extracting credentials or determining login success.

Each configuration endpoint should be defined once, either in the EdgeWorker with px_login_credentials_extraction if custom functions must be implemented, or in the Property Manager with PX_CI_EXTRACT_DETAILS if custom functions aren’t needed.

Regardless, all paths and methods for all credential extraction endpoints must be accounted for in the PXSetCIBypassResponseProviderRule.

An array of configuration objects for each credential endpoint. Each element in the array is an object representing a distinct endpoint to which credentials are sent and includes:

  • How to identify these credential-bearing requests
  • How to extract the credentials from the request
  • How to determine if the request operation (login, signup, etc.) was successful based on the returned HTTP response

Click to expand the full properties list.

path
stringRequired

The path of the request that contains the credentials. It can be either an exact path or a string in the form of a regular expression.

The path values in the PX_CI_EXTRACT_DETAILS array must match the list of paths configured in the Property Manager rule named PXSetCIBypassResponseProviderRule.

Example
1{
2 // ...
3 path: '/sign-up',
4 // ...
5}
path_type
"exact" | "regex"Defaults to "exact"

Whether the incoming request path should be evaluated against the configured path as a regular expression or as an exact match.

  • exact: The value set in path must match the request path exactly as is.
  • regex: The value set in path is a regular expression to be matched against the request path.
Example
1{
2 // ...
3 path: '/auth/[A-Za-z0-9]{12}/login',
4 path_type: 'regex',
5 // ...
6}
method
stringRequired

The HTTP method of the request that contains the credentials. This can be set to any string representing an HTTP method.

Example
1{
2 // ...
3 method: 'POST',
4 // ...
5}
sent_through
"body" | "header" | "query-param" | "custom"Required

Whether the credentials should be extracted from the request headers, query parameters, body, or via a defined custom callback.

  • "body": The credentials will be extracted according to the configured user_field and pass_field values from the request body. The Enforcer parses the request body based on the following Content-Type request header:
    • application/json
    • application/x-www-form-urlencoded
    • multipart/form-data
  • "header": The credentials will be extracted according to the configured user_field and pass_field values from the request headers.
  • "query-param": The credentials will be extracted according to the configured user_field and pass_field values from the request query parameters.
  • "custom": The credentials will be extracted by invoking extract_credentials_callback.
Example
1{
2 // ...
3 sent_through: 'body',
4 // ...
5}
user_field
string

Required if sent_through is set to "body", "header", or "query-param". The name of the field containing the username in the request body, headers, or query parameters.

Supports subfields in cases of Content-Type: application/json bodies with nested objects. The subfields can be separated with periods. For example, the credential endpoint configuration object can include a user_field with the value "user_info.username" and a pass_field with the value "authentication.password" to support extracting the credentials.

1{
2 // ...
3 sent_through: 'body',
4 user_field: 'username',
5 // ...
6}
pass_field
string

Required if sent_through is set to "body", "header", or "query-param". The name of the field, header name, or query parameter where the password can be found.

Supports subfields in cases of Content-Type: application/json bodies with nested objects. The subfields can be separated with periods. For example, the credential endpoint configuration object can include a user_field with the value "user_info.username" and a pass_field with the value "authentication.password" to support extracting the credentials.

1{
2 // ...
3 sent_through: 'body',
4 user_field: 'username',
5 // ...
6}
protocol
"v2" | "multistep_sso" | "both"Defaults to "both"

Whether to process credentials as part of single or multiple HTTP requests. By default, the module tries to process requests depending on which credential fields were extracted.

  • "v2": Both username and password are present on the same HTTP request and must be extracted successfully to trigger Credential Intelligence.
  • "multistep_sso": The username and password are delivered on different HTTP requests. Either the username or password, but not both, must be extracted successfully to trigger Credential Intelligence.
  • "both": The username and password may be present on the same HTTP request or on different HTTP requests. If either username or password is successfully extracted, the Enforcer will send the credentials according to the multistep_sso protocol. If both username and password are successfully extracted, the Enforcer will send the credentials according to the v2 protocol.
Example
1{
2 // ...
3 protocol: 'v2',
4 // ...
5}
login_successful_reporting_method
"status" | "body" | "header" | "custom"Defaults to statusRequired

The method by which the Enforcer will determine whether the login request was successful.

Example
1{
2 // ...
3 login_successful_reporting_method: 'status',
4 // ...
5}
login_successful_statuses
integer[]Defaults to [200]

An array of HTTP statuses signifying a successful login. All other status codes will be treated as unsuccessful login attempts. Takes effect only when the login_successful_reporting_method is set to "status".

Example
1{
2 // ...
3 login_successful_reporting_method: 'status',
4 login_successful_statuses: [200, 202],
5 // ...
6}
login_successful_body_regex
string

Required if login_successful_reporting_method is set to "body". A regular expression (or string representing a regular expression) to against which the response body will be evaluated. A match indicates a successful login.

Example
1{
2 // ...
3 login_successful_reporting_method: 'body',
4 login_successful_body_regex: 'Welcome, [A-Za-z0-9_]+!'
5 // ...
6}
login_successful_header_name
string

Required if login_successful_reporting_method is set to "header". A response header name signifying a successful login response. If the login_successful_header_value field is empty or not configured, any response containing this header name will be considered a successful login. If the login_successful_header_value is configured, the response header value must be an exact match.

Example
1{
2 // ...
3 login_successful_reporting_method: 'header',
4 login_successful_header_name: 'x-login-successful'
5 // ...
6}
login_successful_header_value
string

If this value is configured, a login attempt will be considered successful only if the response contains a header name matching the login_successful_header_name, and whose value is exactly equal to this configuration value. Takes effect only when the login_successful_reporting_method is set to "header".

Example
1{
2 // ...
3 login_successful_reporting_method: 'header',
4 login_successful_header_name: 'x-user-status',
5 login_successful_header_value: 'logged-in'
6 // ...
7}
PX_CI_COMPROMISED_HEADER
stringDefaults to px-compromised-credentials

The header name to be set on the incoming request if the credentials are compromised. If this header is added, its value will always be 1. If credentials have not been identified as compromised, the header will not be added to the request.

PX_CI_AS2S_HEADER_ENABLED
booleanDefaults to false

Whether to attach the additional_s2s payload and URL as headers to the original request. This is done so that the additional_s2s activity can be enriched with the proper login_successful value and sent to the provided URL at a later stage. Enabling this configuration disables automatic sending of additional_s2s activity.

When set to true, the following headers are added to the origin request:

  • px-additional-activity: A JSON object containing the payload of the additional_s2s activity. The login_successful and http_status_code fields should be set prior to sending the activity.
  • px-additional-activity-url: The URL to which the additional_s2s payload should be sent as an HTTP POST request.
Example to handle additional_s2s at the origin
1app.post('/login', (req, res) => {
2 // handle login flow, resulting in variables
3 // isLoginSuccessful (boolean) and responseStatusCode (number)
4
5 if (
6 req.headers['px-additional-activity'] &&
7 req.headers['px-additional-activity-url']
8 ) {
9 handlePxAdditionalActivity(req, responseStatusCode, isLoginSuccessful);
10 }
11});
12
13function handlePxAdditionalActivity(req, statusCode, isLoginSuccessful) {
14 try {
15 // extract url and activity from the request headers
16 const url = req.headers['px-additional-activity-url'];
17 const activity = JSON.parse(req.headers['px-additional-activity']);
18
19 // enrich the activity details with added information
20 activity.details['http_status_code'] = statusCode;
21 activity.details['login_successful'] = isLoginSuccessful;
22
23 if (activity.details['credentials_compromised'] && isLoginSuccessful) {
24 // add raw username if credentials are compromised and login is successful (only if desired)
25 activity.details['raw_username'] = req.body.username;
26 } else {
27 // remove raw username if login is not successful or credentials are not compromised
28 delete activity.details['raw_username'];
29 }
30
31 // send the POST request
32 axios.post(url, activity, {
33 headers: {
34 'Authorization': `Bearer ${env.PX_AUTH_TOKEN}`,
35 'Content-Type': 'application/json'
36 }
37 });
38 } catch (err) {
39 console.error(`Error: ${err}`);
40 }
41}
PX_CI_SEND_RAW_USERNAME
booleanDefaults to false

Whether to report the raw username on the additional_s2s activity.

  • false: The raw username will never be reported.
  • true: The raw username will only be reported if:
    • The credentials are compromised, and
    • The login request was successful.
PX_CI_LS_REPORTING_METHOD
"status" | "body" | "header" | "custom"Defaults to statusDeprecated

This configuration is deprecated. Use PX_CI_EXTRACT_DETAILS.login_successful_reporting_method instead.

The default login-success detection method applied to endpoints that don’t override it. See login_successful_reporting_method for the possible values.

PX_CI_LS_STATUS
integer[]Defaults to 200Deprecated

This configuration is deprecated. Use PX_CI_EXTRACT_DETAILS.login_successful_statuses instead.

The default HTTP status codes that indicate a successful login. This takes effect when the PX_CI_LS_REPORTING_METHOD is set to status.

PX_CI_LS_BODY_REGEX
stringDeprecated

This configuration is deprecated. Use PX_CI_EXTRACT_DETAILS.login_successful_body_regex instead.

The default body regular expression that indicates a successful login. This takes effect when the PX_CI_LS_REPORTING_METHOD is set to body.

PX_CI_LS_HEADER_NAME
stringDeprecated

This configuration is deprecated. Use PX_CI_EXTRACT_DETAILS.login_successful_header_name instead.

The default response header name that indicates a successful login. This takes effect when the PX_CI_LS_REPORTING_METHOD is set to header.

PX_CI_LS_HEADER_VALUE
stringDeprecated

This configuration is deprecated. Use PX_CI_EXTRACT_DETAILS.login_successful_header_value instead.

The default response header value that indicates a successful login. This takes effect when the PX_CI_LS_REPORTING_METHOD is set to header.

PX_CI_VERSION
"v2" | "multistep_sso" | "both"Defaults to bothDeprecated

This configuration is deprecated. Use PX_CI_EXTRACT_DETAILS.protocol instead.

The default credential hashing protocol applied to endpoints that do not specify a protocol field.

  • "v2": Both username and password are present on the same HTTP request and must be extracted successfully to trigger Credential Intelligence.
  • "multistep_sso": The username and password are delivered on different HTTP requests. Either the username or password, but not both, must be extracted successfully to trigger Credential Intelligence.
  • "both": The username and password may be present on the same HTTP request or on different HTTP requests. If either username or password is successfully extracted, the Enforcer will send the credentials according to the multistep_sso protocol. If both username and password are successfully extracted, the Enforcer will send the credentials according to the v2 protocol.

CORS support

You can configure the Enforcer to support Cross-Origin Resource Sharing (CORS) requests. CORS is a mechanism that lets the server indicate if a request contains cross-origin resources by adding special HTTP headers to the request. These headers let the browser load these resources. Without them, the browser may block requests to these resources for security reasons instead.

In most cases, CORS employs a two-stage procedure with a preliminary “preflight” request followed by the actual request. The preflight request checks if the actual request will be responded to. To learn more about different request types, see these examples.

You must configure the Enforcer to address both simple requests (without preflight) and more complex ones (with preflight) to support CORS requests.

See CORS support for custom function options.

PX_CORS_SUPPORT_ENABLED
booleanDefaults to false

Since Akamai EdgeWorkers don’t support the OPTIONS method, CORS preflight requests are always filtered and won’t pass through the EdgeWorker. Therefore, you must handle preflight requests elsewhere in your Akamai Property Manager or in your origin server.

Whether to enable CORS support.

  • true: Enable CORS support
  • false: Disable CORS support

After setting this configuration to true, the Enforcer:

  • Automatically adds the following default CORS response headers to block responses resulting from CORS requests.
    Access-Control-Allow-Origin: <ORIGIN_REQUEST_HEADER_VALUE>
    Access-Control-Allow-Credentials: true
  • Activates the px_cors_create_custom_block_response_headers configuration, which lets you customize the block response headers via a custom function.
stringDefaults to x-px-cookies

By default, the Enforcer extracts HUMAN cookies from the Cookie header. However, if these cookies are transferred on a different header, then that header’s name must be provided with this configuration.

Enforced routes

These configurations let you define specific routes that should be enforced by HUMAN when the Enforcer is in monitor mode. These routes will always be subject to the full Enforcer workflow, including blocking requests if necessary.

See Enforced routes for custom function options.

PX_ENFORCED_ROUTES
stringDefaults to empty

Routes or prefixes that should be enforced by HUMAN even when the Enforcer is in monitor mode.

Routes must be configured as a single regular expression (RegExp). For case-insensitive matching, the end the regex with the i flag.

Filters

These configurations let you filter out certain requests or assets from the Enforcer. These values will be ignored by the Enforcer and will never be blocked.

See Filters for custom function options.

PX_FILTER_BY_EXTENSION
stringDefaults to .css,.bmp,.tif,.ttf,.docx,.woff2,.js,.pict,.tiff,.eot,.xlsx,.jpg,.csv,.eps,.woff,.xls,.jpeg,.doc,.ejs,.otf,.pptx,.gif,.pdf,.swf,.svg,.ps,.ico,.pls,.midi,.svgz,.class,.png,.ppt,.mid,.webp,.jar,.json,.xml

Must match those configured in the PXWorkerRule and PXStaticContentWorkerRule in the Akamai Property Manager.

Filters out requests with the specified file extension. By default, HUMAN doesn’t enforce static assets such as images and documents to minimize unncessary API calls and computation, but you can configure this list at any time.

Filtering by extension only applies to GET and HEAD HTTP methods.

Configure as a comma-separated list.

PX_FILTER_BY_HTTP_METHOD
stringDefaults to HEAD,TRACE

To avoid invoking the Akamai EdgeWorker in its entirety for these HTTP methods, you can also implement this by editing the PXWorkerRule in the Property Manager. Under the Criteria section, add another match as follows:

  • Request Method: Request Method
  • Operator: is not
  • Value: The HTTP methods you want to filter out (e.g. HEAD, TRACE)

Filters out requests with the specified HTTP method to avoid unnecessary traffic in the Enforcer verification flow. Configure as a comma-separated list.

PX_FILTER_BY_IP
stringDefaults to empty

Filters out requests with the specified IP address to avoid unnecessary traffic in the Enforcer verification flow. Configure IPs or CIDR ranges as a comma-separated list (for example, 1.1.1.1,2.2.2.2/8).

PX_FILTER_BY_ROUTE
stringDefaults to empty

Filters out requests with the specified route to avoid unnecessary traffic in the Enforcer verification flow. Requests to these specified routes will never be blocked regardless of their risk score and will never generate risk or async activities. Routes must be configured as a single regular expression (RegExp). For case-insensitive matching, the end the regex with the i flag (for example, /^(./allowed_route/?.)|(./filtered_route/?.)$/i).

PX_FILTER_BY_USER_AGENT
stringDefaults to empty

Filters out requests with the specified user agent to avoid unnecessary traffic in the Enforcer verification flow. User agents must be configured as a single regular expression (RegExp). For case-insensitive matching, the end the regex with the i flag (for example, /^(filtered-ua)|(filtered-user-agent)$/).

First party

These configurations let you use the Enforcer as a proxy for HUMAN servers and serve content to the browser from a first party endpoint. These are particularly useful when browser or extension restrictions that block JavaScript requests to other domains, such as adblockers, prevent the HUMAN Sensor from making requests to HUMAN’s backend. When this happens, it significantly limits HUMAN’s detection capabilities, so we recommend enabling these configurations to maintain full detection capabilities.

PX_FIRST_PARTY_ENABLED
booleanDefaults to true

Whether to enable first party mode for Bot Defender or Sightline Cyberfraud Defense.

GraphQL support

These configurations let the Enforcer extract GraphQL data from requests so that it can enforce these requests in the same way as other types of traffic.

See GraphQL support for custom function options.

PX_GRAPHQL_ENABLED
booleanDefaults to true

Whether to parse and report information about GraphQL operations on incoming requests. When true, all POST requests with routes that match the prefixes configured in PX_GRAPHQL_ROUTES will have their bodies parsed for GraphQL operations.

  • true: Enable GraphQL support
  • false: Disable GraphQL support
PX_GRAPHQL_ROUTES
stringDefaults to /^/graphql$/i

Must match those configured in the PXSetGraphqlBypassResponseProviderRule in the Akamai Property Manager.

A regular expression that matches all routes that should be considered GraphQL routes. If PX_GRAPHQL_ENABLED is true, all POST requests with routes that match the configured regex will have their bodies parsed for GraphQL operations. For case-insensitive matching, the regex should end with the i flag.

PX_SENSITIVE_GQL_OP_NAMES
stringDefaults to empty

A regular expression (RegExp) of operation names that should be considered sensitive. Some routes may be more prone to bot attacks than others, such as routes that execute payments or handle personal information. You can configure these routes as sensitive to ensure a more stringent protection.

If one or more GraphQL operations has a name or keyword matching this regular expression (RegExp), the Enforcer will trigger a Risk API call even if the request contains a valid, unexpired cookie. Matches against extracted GraphQL words from:

For case-insensitive matching, the regex should end with the i flag. For example, /^(LoginOperation|SignIn)$/i.

PX_SENSITIVE_GQL_OP_TYPES
query | mutation | subscriptionDefaults to empty

A comma-separated list of operation types that should be considered sensitive. Some routes may be more prone to bot attacks than others, such as routes that execute payments or handle personal information. You can configure these routes as sensitive to ensure a more stringent protection.

If one or more GraphQL operations on an HTTP request has a type matching this list, the Enforcer will trigger a Risk API call even if the request contains a valid, unexpired cookie.

PX_GRAPHQL_KEYWORDS
stringDefaults to empty

A regular expression (RegExp) of keywords to identify important terms from GraphQL operation queries. These keywords are used to determine the purpose of the operation (such as login, checkout, or search) and can also be used to specify which operations should be considered sensitive. Any matching patterns will be extracted and reported to HUMAN. See PX_SENSITIVE_GQL_OP_NAMES for more information. See px_extract_graphql_keywords for an alternative using a custom function.

For case-insensitive matching, the regex should end with the i flag. For example, /(\w*[Ll]ogin\w*)|(\w*[Ss]ignup\w*)/i.

Header data enrichment

These configurations let you add headers to incoming requests with additional data.

PX_DE_HEADER_NAME
stringDefaults to ""

Adds a header to the incoming request with the configured header name and the JSON-stringified data enrichment object as the value. If empty or if data enrichment has not been enabled for your policy, no header will be set. To view available data and enable this feature, see Data classification enrichment.

HUMAN Challenge customization

These configurations let you customize the HUMAN Challenge block page.

PX_CSS_REF
string

A way to include a custom CSS file to the block page.

For example, https://www.example.com/custom/style.css.

PX_JS_REF
string

A way to include custom JavaScript to the block page. This script will run after the default JavaScript scripts.

For example, https://www.example.com/custom_script.js.

stringDefaults to ""

Adds a custom logo to the HUMAN Challenge block page via URL.

For example, https://www.example.com/custom_logo.png.

Monitored routes

These configurations let you specify routes that should be monitored by the Enforcer, which means their requests will never be blocked, even when the Enforcer is in active_blocking mode. This means that these routes will go through the full Enforcer workflow and generate risk and async activities, but all block activities will only be simulated blocks on these routes.

See Monitored routes for custom function options.

PX_MONITORED_ROUTES
stringDefaults to empty

A regular expression (RegExp) of endpoints to be monitored rather than blocked by the Enforcer, even when the Enforcer is in active_blocking mode. For case-insensitive matching, the regex should end with the i flag. For example, /^(./category/?.)|(./product/?.)$/i.

PX_SECURED_PXHD_ENABLED
booleanDefaults to false

The PX Hashed Data (PXHD) cookie links the first risk request with the browser activities as detected by the Sensor for better user tracking. It can also add more information that’s shared between the HUMAN Collector, Enforcer, and Sensor. This configuration determines whether the Secure cookie attribute is added when setting the PXHD cookie.

See Use of cookies & web storage for more information.

  • true: Adds the Secure attribute to the PXHD cookie
  • false: Does not add the Secure attribute to the PXHD cookie

Remote Configuration

Remote Configuration lets you update your Enforcer’s configuration from the HUMAN portal rather than interacting with the Enforcer package directly.

Remote Configuration requires access to Akamai EdgeKV and adding the EdgeKV helper library to your Akamai EdgeWorker.

PX_LOGGER_AUTH_TOKEN
stringDefaults to emptyRequired

An alternative to the basic logger configuration. This sends Enforcer logs to HUMAN’s logging service if a specific header is present on the request. This is particularly useful for expedited debugging, diagnosis, and resolution of any integration or Enforcer-related issues.

Contact HUMAN to recieve your token.

Security Settings: Hidden

PX_RC_AUTH_TOKEN
stringDefaults to emptyRequired

The token used to authenticate the Enforcer with the HUMAN Remote Configuration service.

Contact HUMAN to receive your token. Security Settings: Hidden

PX_RC_ID
stringDefaults to emptyRequired

The ID associated with the Remote Configuration.

Contact HUMAN to receive your ID.

PX_RC_MAX_FETCH_ATTEMPTS
integerDefaults to 5

The maximum number of time to attempt to fetch the Remote Configuration. If the Enforcer fails to fetch the Remote Configuration after the specified maximum, it will use the last known configuration.

PX_RC_RETRY_INTERVAL
integerDefaults to 1000

The interval time in milliseconds to wait between attempts to fetch the Remote Configuration.

Sensitive headers removal

PX_SENSITIVE_HEADERS
stringDefaults to cookie,cookies

Specifies certain headers that should not be forwarded to any other destination, including the HUMAN Detector. While HUMAN’s detection system will continue to use these headers to determine whether to block or not, the specified headers won’t be forwarded from the Enforcer, won’t appear in Enforcer activities, and won’t be sent to any other IP if the Enforcer acts as a proxy. Should be configured as a comma-separated list of header names.

Sensitive routes

These configurations let you specify certain routes that need particularly stringent protection from attacks, such as endpoints that execute payments or handle personal information. Sensitive routes will always trigger a Risk API call even if the request contains a valid, unexpired, low-score cookie.

Requests with high-score cookies won’t send a Risk API call.

See Sensitive routes for custom function options.

PX_SENSITIVE_ROUTES
stringDefaults to empty

A regular expression (RegExp) of prefixes for all routes that should be considered sensitive.

For case-insensitive matching, the regex should end with the i flag. For example, /^(/login/.*)|(/sign/)$/i.

URL-decode reserved characters

PX_DEC_URL_RESERVED_CHARS
booleanDefaults to false

When true, the Enforcer will decode reserved characters such as %3F and %2F in the request URL path prior to processing. In other words, the Enforcer will treat the URIs /login%3F.ico and /login?.ico as equivalent. By default, the Enforcer doesn’t decode reserved characters and treats these URLs separately.

  • true: Decode reserved characters in the request URL.
  • false: Do not decode reserved characters in the request URL.

Users identifiers

These configurations let you extract user identifiers from a JWT carried on the request either in a cookie or a header. They’re closely related to the Accounts and Account Takeover or Fake Account features in Sightline Cyberfraud Defense.

stringDefaults to empty

The name of the cookie that contains the JWT token that HUMAN should extract user identifiers from. For example, auth.

stringDefaults to empty

The field name in the JWT object, extracted from the JWT cookie, that contains the user ID to be extracted and reported. For example, nameID.

stringDefaults to empty

The field names in the JWT object, extracted from the JWT cookie, that should be extracted and reported in addition to the user ID. The field names should be configured as a comma-separated list. For example, exp,iss.

PX_JWT_HEADER_NAME
stringDefaults to empty

The name of the header that contains the JWT token that HUMAN should extract user identifiers from. For example, x-jwt-authorization.

PX_JWT_HEADER_USERID_NAME
stringDefaults to empty

The field name in the JWT object, extracted from the JWT header, that contains the user ID to be extracted and reported. For example, sub.

PX_JWT_HEADER_ADDL_FIELDS
stringDefaults to empty

The field names in the JWT object, extracted from the JWT header, that should be extracted and reported in addition to the user ID. The field names should be configured as a comma-separated list. For example, exp,iss.

Custom functions

Some supported features can’t be expressed as Akamai Property Manager variables. Instead, you can define custom functions in the HumanSecurityFunctionsConfiguration object directly within the Akamai EdgeWorker code. This should be done in example/src/customFunctions.ts or the equivalent source file used for bundling.

Do not add custom functions post-build to the compiled Worker output.

These functions may be invoked during the onClientRequest, onClientResponse, or responseProvider events. Since the request and response objects vary in structure between events, we strongly recommend performing runtime checks for the existence of properties and methods before accessing them directly.

Refer to Akamai’s documentation for request methods and response methods for available events.

Additional activity handler

px_additional_activity_handler
functionDefaults to null

A custom function passed to the Enforcer that runs after sending page_requested or block activity to the Collector and before forwarding the request to the next step in the pipeline. A common use case is to set the score as a variable or header. Then the application can read the score and do what is defined within the application’s logic.

The request body can only be read once! If you plan on reading the request body in this function, we recommend you use the HumanSecurityUtils.getRequestBody() function to read the request body safely.

Parameters:

Returns: void or a Promise resolving to void

Example
1const config: HumanSecurityFunctionsConfiguration = {
2 // ...
3 px_additional_activity_handler: (
4 config: HumanSecurityConfiguration,
5 context: IContext,
6 request: EW.IngressClientRequest | EW.ResponseProviderRequest
7 ): void => {
8 if ('setHeader' in request) {
9 request.setHeader('x-px-score', `${context.score}`);
10 request.setHeader('x-px-rtt', `${context.riskApiData.riskRtt}`);
11 }
12 },
13 // ...
14}

CORS support

See CORS support for Property Manager options.

px_cors_create_custom_block_response_headers
functionDefaults to null

If the default CORS response headers are not sufficient, you can use this configuration to customize the headers that should be added to all block responses resulting from CORS requests. If this function is defined, the default headers will not be added. Only those headers specified in the returned object will be added to the block response.

Parameters:

Returns: An object of the type Record<string, string[]> or a Promise resolving to this type

Example
1const config: HumanSecurityFunctionsConfiguration = {
2 // ...
3 px_cors_create_custom_block_response_headers: (
4 request: EW.IngressClientRequest | EW.ResponseProviderRequest,
5 ): Record<string, string[]> => {
6 return {
7 'Access-Control-Allow-Origin': [request.getHeader('origin')?.[0] ?? '*'],
8 'Access-Control-Allow-Credentials': ['false'],
9 'Access-Control-Allow-Methods': ['GET', 'POST', 'PUT'],
10 'X-Custom-Header': ['1']
11 };
12 },
13 // ...
14}

Credentials Intelligence

See Credentials Intelligence for Property Manager options.

extract_credentials_callback
function

Required if sent_through is set to "custom". A custom credential extraction callback that returns the raw credentials from the request. It receives the HTTP request as a parameter and should return a Credentials object:

Credentials object example
1type Credentials = {
2 user?: string; // the raw username
3 pass?: string; // the raw password
4};

Parameters:

Returns: A Credentials object or a Promise resolving to a Credentials object. If neither the username or the password can be extracted from the request, the function should return null.

The request body can only be read once! If you plan on reading the request body in this function, we recommend you use the HumanSecurityUtils.getRequestBody() function to read the request body safely.

Example
1{
2 // ...
3 sent_through: 'custom',
4 extract_credentials_callback: async (request: EW.ResponseProviderRequest): Promise<{ user?: string; pass?: string; }> => {
5 const body: string | undefined = await HumanSecurityUtils.getRequestBody(request);
6
7 // custom logic to extract credentials from the request body
8
9 if (!username || !password) {
10 return null;
11 }
12 return { user: username, pass: password };
13 },
14 // ...
15}
login_successful_callback
function

Required if login_successful_reporting_method is set to "custom". A custom callback that accepts the HTTP response and returns a boolean or Promise resolving to a boolean that indicates whether the login attempt was successful.

Parameters:

  • response: { status: number; headers: Record&lt;string, string[]&gt;; body: any }

Returns: A boolean or a Promise resolving to a boolean.

The response body can only be read once! If you plan on reading the response body in this function, we recommend you use the HumanSecurityUtils.getResponseBody() function to read the response body safely.

Example
1{
2 // ...
3 login_successful_reporting_method: 'custom',
4 login_successful_callback: async (response: { status: number; headers: Record<string, string[]>; body: any }): Promise<boolean> => {
5 return response.status === 200
6 && response.headers['set-cookie']?.some((val) => val.includes('session_token='))
7 && await HumanSecurityUtils.getResponseBody(response).includes('Welcome!');
8 },
9 // ...
10}

Custom parameters

These configurations are related to custom parameters.

px_enrich_custom_parameters
functionDefaults to null

Custom parameters added with this function must be defined before the Worker is bundled.

Enriches activities sent from the Enforcer to HUMAN with additional custom parameters. This data can include user information, session IDs, or other data that HUMAN should have access to. These custom parameters are defined by a configurable function that must return an object that contains these custom parameters. There is a limit of 10 custom parameters.

The request body can only be read once! If you plan on reading the request body in this function, we recommend you use the HumanSecurityUtils.getRequestBody() function to read the request body safely.

Parameters:

Returns: Promise<CustomParameters>

Example
1const config: HumanSecurityFunctionsConfiguration = {
2 // ...
3 px_enrich_custom_parameters: async (
4 config: HumanSecurityConfiguration,
5 request: EW.IngressClientRequest | EW.ResponseProviderRequest,
6 ): CustomParameters | Promise<CustomParameters> => {
7 let body = null;
8 if ('body' in request && request.method === 'POST') {
9 try {
10 body = JSON.parse(await HumanSecurityUtils.getRequestBody(request))
11 } catch {
12 // fail silently
13 }
14 }
15 return {
16 custom_param1: 'hardcoded value',
17 custom_param2: request.getHeader('header-name'),
18 custom_param3: body?.['body_property']
19 };
20 },
21 // ...
22}

Enforced routes

See Enforced routes for Property Manager options.

px_custom_is_enforced_request
functionDefaults to null

This configuration is meant for cases that require more complex logic. We recommended you use PX_ENFORCED_ROUTES for most cases.

A custom function that lets you define which requests should be enforced based on custom logic. It accepts the incoming request as an argument and returns a boolean indicating whether the request should be enforced.

Parameters:

Returns: A boolean or a Promise resolving to a boolean.

Example
1const config: HumanSecurityFunctionsConfiguration = {
2 // ...
3 px_custom_is_enforced_request: (request: EW.IngressClientRequest | EW.ResponseProviderRequest): boolean | Promise<boolean> => {
4 return request.method === 'POST' && request.path.startsWith('/enforced_route');
5 },
6 // ...
7}

Filters

See Filters for Property Manager options.

px_custom_is_filtered_request
functionDefaults to null

This configuration is meant for cases that require more complex logic. We recommended you use the other default filters available for most cases.

A custom function that lets you define which requests should be filtered based on custom logic. It accepts the incoming request as an argument and returns a boolean indicating whether the request should be filtered.

Parameters:

Returns: A boolean or a Promise resolving to a boolean.

Example
1const config: HumanSecurityFunctionsConfiguration = {
2 // ...
3 px_custom_is_filtered_request: (request: EW.IngressClientRequest | EW.ResponseProviderRequest): boolean | Promise<boolean> => {
4 return request.method === 'GET' && request.path.startsWith('/static/');
5 },
6 // ...
7}

GraphQL support

See GraphQL support for Property Manager options.

px_extract_graphql_keywords
functionDefaults to null

A custom function that identifies key terms from GraphQL operation queries. An alternative to the PX_GRAPHQL_KEYWORDS configuration.

This function accepts the GraphQL query string and must return an array of strings representing all keywords found in the query. These keywords are used to determine the purpose of the operation (such as login, checkout, search) and can also be used to specify which GraphQL operations should be considered sensitive. See PX_SENSITIVE_GQL_OP_NAMES for more information.

If this function is defined and returns an array (even an empty array), then the returned array will be used as the GraphQL keywords. If this function is defined and returns null, then the query will continue to be evaluated using PX_GRAPHQL_KEYWORDS.

Parameters:

  • graphqlQuery: string

Returns string[] or a Promise resolving to string[].

Example
1const config: HumanSecurityFunctionsConfiguration = {
2 // ...
3 px_extract_graphql_keywords: (graphqlQuery: string): string[] | Promise<string[]> => {
4 if (/userId\d+/.test(graphqlQuery)) {
5 // report no keywords for this query
6 return [];
7 } else if (/perform(Login|Signin)/.test(graphqlQuery)) {
8 // always report 'login' as the only keyword for this query
9 return ['login'];
10 } else {
11 // process query according to px_graphql_keywords configuration
12 return null;
13 }
14 },
15 // ...
16}

Monitored routes

See Monitored routes for Property Manager options.

px_custom_is_monitored_request
functionDefaults to null

This configuration is meant for cases that require more complex logic. We recommended you use PX_MONITORED_ROUTES for most cases.

A custom function that lets you define which endpoints should be monitored based on custom logic. It accepts the incoming request as an argument and returns a boolean indicating whether the request should be monitored.

Parameters:

Returns: A boolean or a Promise resolving to a boolean.

Example
1const config: HumanSecurityFunctionsConfiguration = {
2 // ...
3 px_custom_is_monitored_request: (request: EW.IngressClientRequest | EW.ResponseProviderRequest): boolean | Promise<boolean> => {
4 return request.method === 'GET' && request.path.startsWith('/monitored');
5 },
6 // ...
7}

Response custom parameters

These configurations enrich async activities with values derived from the origin response.

px_enrich_response_custom_parameters
functionDefaults to null

A function that receives the configuration and the response from the origin and returns up to ten fields: custom_param11 through custom_param20. These are merged into page_requested, additional_s2s, and simulated block activities. There is a limit of ten response custom parameters.

The response body can only be read once! If you plan on reading the response body in this function, we recommend you use the HumanSecurityUtils.getResponseBody() function to read the response body safely.

Parameters:

  • config: HumanSecurityConfiguration
  • response: { status: number; headers: Record&lt;string, string[]&gt;; body: any }

Returns: An object with custom_param11custom_param20 keys, or a Promise resolving to that object.

Example
1const config: HumanSecurityFunctionsConfiguration = {
2 // ...
3 px_enrich_response_custom_parameters: async (
4 config: HumanSecurityConfiguration,
5 response: { status: number; headers: Record<string, string[]>; body: any },
6 request?: EW.ResponseProviderRequest | EW.IngressClientRequest,
7 ): Promise<Record<string, string>> => {
8 const bodyText = await HumanSecurityUtils.getResponseBody(response);
9 return {
10 custom_param11: response.headers['x-request-id']?.[0] ?? '',
11 custom_param12: String(response.status),
12 custom_param13: request?.getHeader('user-agent')?.[0] ?? '',
13 custom_param14: bodyText?.includes('success') ? 'true' : 'false',
14 // ... up to custom_param20
15 };
16 },
17 // ...
18}

Sensitive routes

See Sensitive routes for Property Manager options.

px_custom_is_sensitive_request
functionDefaults to null

This configuration is meant for cases that require more complex logic. We recommended you use PX_SENSITIVE_ROUTES for most cases.

A custom function that lets you define which requests should be considered sensitive based on custom logic. It accepts the incoming request as an argument and returns a boolean indicating whether the request should be considered sensitive.

Parameters:

Returns: A boolean or a Promise resolving to a boolean.

Example
1const config: HumanSecurityFunctionsConfiguration = {
2 // ...
3 px_custom_is_sensitive_request: (request: EW.IngressClientRequest | EW.ResponseProviderRequest): boolean | Promise<boolean> => {
4 return request.method === 'POST' || request.method === 'PUT';
5 },
6 // ...
7}