ASP.NET 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. Set ASP.NET Enforcer configurations as XML attributes in the pxModuleConfigurationSection element of your application

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.

Comma-delimited list attributes such as sensitiveRoutes or ipWhitelist map to .NET StringCollection values. Custom logic options use a class name string: implement the corresponding HUMAN interface, put your logic in that class’s Handle method, and set the configuration attribute to the class name so the Enforcer can load it.

Quick reference

Feature nameKeyTypeDefaultDescription
Application IDappIdStringHUMAN Application ID
Authentication tokenapiTokenString""HUMAN authentication token
Cookie secretcookieKeyStringHUMAN cookie secret
Backend domainbaseUriStringhttps://sapi-{0}.perimeterx.netDomain to which HUMAN requests are sent. {0} is replaced with the application ID.
S2S timeoutapiTimeoutInteger1500Total time, in milliseconds, that the Enforcer will wait for the Risk API request to return before timing out and passing the request
Blocking scoreblockingScoreInteger1000-100. The minimum risk score that the Enforcer blocks from.

Required configurations

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

Basic functionality configurations

appId
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.

Example
...
appId="<APP_ID>"
...
apiToken
stringRequired

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.

Example
...
apiToken="<AUTH_TOKEN>"
...
cookieKey
stringRequired

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.

Example
...
cookieKey="<COOKIE_SECRET>"
...
baseUri
stringDefaults to https://sapi-{0}.perimeterx.netRequired

Do not set this value unless directed by your HUMAN Solutions Engineer.

The base URL for the HUMAN SAPI (Risk API and related calls). If empty, the Enforcer uses the default host for your Application ID.

The default value uses {0} as a placeholder for your application ID. Change this only after discussing the change with HUMAN Support.

Example
...
baseUri="https://sapi-{0}.perimeterx.net"
...
apiTimeout
integerDefaults to 1500Required

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

Example
...
apiTimeout="1500"
...
blockingScore
integerDefaults to 100Required

The minimum risk score that the Enforcer will block. Ranges from 0 (lowest risk) to 100 (highest risk).

Example
...
blockingScore="100"
...

Basic feature configurations

socketIpHeader
stringRequired

Header name that contains the real client IP. If unset, the Enforcer uses the request’s UserHostAddress.

Configure this when a load balancer or proxy sits in front of your application so HUMAN receives the true client IP for detection.

Example
...
socketIpHeader="X-PX-TRUE-IP"
...
enabled
booleanDefaults to trueRequired

Whether the Enforcer module is enabled.

  • true: Enable the module
  • false: Disable the module
Example
...
enabled="true"
...
monitorMode
booleanDefaults to trueRequired

When true, 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.

When false, the Enforcer returns block responses as needed.

Example
...
monitorMode="false"
...

Optional configurations

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

Bypass monitor header

bypassMonitorHeader
string

Activates the full blocking flow to verify the flow works as expected if the specified header is present on the request with a value of 1. Often used to test the Enforcer block workflow during monitor mode, where the Enforcer usually collects data without blocking user requests, before switching to false. Requests with this header will go through the entire blocking workflow despite being in monitor mode.

To disable blocking behavior on the specified header, set the value to 0.

Example
...
bypassMonitorHeader="x-px-block"
...

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:

loginCredentialsExtractionEnabled
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
Example
...
loginCredentialsExtractionEnabled="true"
...
loginCredentialsExtraction
string

JSON array of credential extraction definitions, set as an XML attribute string. Each object configures one login endpoint.

PropertyTypeDescriptionPossible values
methodStringHTTP method of the login requestAny HTTP method
path_typeStringWhether path is an exact match or a regular expressionexact, regex
pathStringLogin request pathExact path or regex
sent_throughStringWhere credentials appear on the requestbody, header, query-param, custom
user_fieldStringUsername field name (not required when sent_through is custom)
pass_fieldStringPassword field name (not required when sent_through is custom)

When sent_through is custom, configure customCredentialsExtractionHandler. All endpoints with sent_through: "custom" use that handler.

Example
...
loginCredentialsExtraction='[{"method":"post","path_type":"exact","path":"/login","sent_through":"body","user_field":"username","pass_field":"password"},{"method":"post","path_type":"exact","path":"/login/custom","sent_through":"custom"}]'
...
ciVersion
"v2" | "multistep_sso"Defaults to v2

Credentials Intelligence protocol to use for extracted login data.

  • v2: Single-step login
  • multistep_sso: Multi-step login
Example
...
ciVersion="v2"
...
compromisedCredentialsHeader
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.

Example
...
compromisedCredentialsHeader="px-compromised-credentials"
...
additionalS2SActivityHeaderEnabled
booleanDefaults to false

Whether to attach the additional_s2s payload and URL as headers on the original request so your origin can enrich and send the activity later. When true, the Enforcer does not send additional_s2s automatically.

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. Set the login_successful and http_status_code fields before sending the activity.
{
"type": "additional_s2s",
"timestamp": 1637000000,
"socket_ip": "1.1.1.1",
"px_app_id": "PX_APP_ID",
"url": "https://www.example.com/the-target-url",
"vid": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"details": {
"client_uuid": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"request_id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"ci_version": "v1",
"http_status_code": null, // MODIFY, number (e.g., 200, 401, 404, etc.)
"login_successful": null, // MODIFY, boolean (e.g., true, false)
"raw_username": null // MODIFY, string (e.g., "test@mail.com")
}
}
  • px-additional-activity-url: The URL to which the additional_s2s payload should be sent as an HTTP POST request.

Send the POST with Content-Type: application/json and Authorization: Bearer <AUTH_TOKEN>.

To send additional_s2s automatically from the Enforcer instead, leave this set to false and configure loginSuccessfulReportingMethod. If the reporting method is left empty, login success is always reported as false.

Example
...
additionalS2SActivityHeaderEnabled="true"
...
sendRawUsernameOnAdditionalS2SActivity
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.
Example
...
sendRawUsernameOnAdditionalS2SActivity="true"
...
loginSuccessfulReportingMethod
"status" | "body" | "header" | "custom"

Method used to decide whether a login succeeded when the Enforcer sends additional_s2s automatically. If left empty, login success is always reported as false.

Provide status codes that represent a successful login via loginSuccessfulStatus. If the response status matches one of those values, login success is true; otherwise it is false.

To define a status range, use the custom reporting method.

...
loginSuccessfulReportingMethod="status"
loginSuccessfulStatus="200,201,202"
...

Configure loginSuccessfulBodyRegex. If the response body matches the regex, login success is true.

...
loginSuccessfulReportingMethod="body"
loginSuccessfulBodyRegex=".*You logged in successfully.*"
...

Configure customLoginSuccessfulHandler. The handler’s return value sets login_successful.

Example
...
loginSuccessfulReportingMethod="status"
...
loginSuccessfulStatus
comma-delimited list of integers

HTTP status codes treated as a successful login when loginSuccessfulReportingMethod is status.

Example
...
loginSuccessfulStatus="200,201"
...
loginSuccessfulBodyRegex
string

Regular expression matched against the response body when loginSuccessfulReportingMethod is body.

Example
...
loginSuccessfulBodyRegex=".*You logged in successfully.*"
...
loginSuccessfulHeaderName
string

Response header name checked when loginSuccessfulReportingMethod is header.

Example
...
loginSuccessfulHeaderName="login-successful"
...
loginSuccessfulHeaderValue
string

Expected response header value when loginSuccessfulReportingMethod is header.

Example
...
loginSuccessfulHeaderValue="true"
...
customCredentialsExtractionHandler
string

Class name of an ICredentialsExtractionHandler implementation used when a credentials extraction endpoint sets sent_through to custom.

The Handle method receives an HttpRequest and should return an ExtractedCredentials object, or null if extraction fails.

Example
...
customCredentialsExtractionHandler="MyCredentialsExtractorHandler"
...
Handler example
namespace myUniqueApp
{
public class MyCredentialsExtractorHandler : ICredentialsExtractionHandler
{
public ExtractedCredentials Handle(HttpRequest httpRequest)
{
// Custom credentials extraction logic goes here.
return new ExtractedCredentials("user", "pass");
}
}
}
customLoginSuccessfulHandler
string

Class name of an ILoginSuccessfulHandler implementation used when loginSuccessfulReportingMethod is custom.

The Handle method receives an HttpResponse and returns whether the login succeeded.

Example
...
customLoginSuccessfulHandler="MyLoginSuccessfulHandler"
...
Handler example
namespace myUniqueApp
{
public class MyLoginSuccessfulHandler : ILoginSuccessfulHandler
{
public bool Handle(HttpResponse httpResponse)
{
// Custom implementation resulting in boolean isLoginSuccessful
return isLoginSuccessful;
}
}
}

Custom block page

Use these options to serve a custom block experience instead of the default HUMAN Challenge block page. To customize HUMAN’s default page, see HUMAN Challenge customization.

customBlockUrl
string

URL of the custom block page HTML file. The Enforcer automatically allows this URI to avoid infinite redirects.

As of version 2.8.0, CAPTCHA logic is handled by the JavaScript snippet rather than the Enforcer. Custom block pages must include the required script tag and div for the challenge.

Example
...
customBlockUrl="https://www.example.com/block.html"
...
redirectOnCustomUrl
booleanDefaults to false

When true and customBlockUrl is set, blocked users receive a 307 Temporary Redirect to the custom block page, with query parameters such as:

https://www.example.com/block.html?url=L3NvbWVwYWdlP2ZvbyUzRGJhcg==&uuid=e8e6efb0-8a59-11e6-815c-3bdad80c1d39&vid=08320300-6516-11e6-9308-b9c827550d47

The url parameter is the original path and query, URL-encoded and then Base64-encoded, so it does not collide with block-page query parameters.

When false, the Enforcer returns 403 on the blocked request URL and injects the block page content (or custom page content) without requiring those query parameters on your page.

Example
...
redirectOnCustomUrl="false"
...
customCookieHeader
stringDefaults to x-px-cookies

When set, the Enforcer reads HUMAN cookies from this header in addition to (or instead of relying solely on) the standard Cookie header.

Example
...
customCookieHeader="x-px-cookies"
...

Custom parameters

These configurations are related to custom parameters.

customParametersHandler
string

Class name of an ICustomParametersHandler implementation. The Enforcer calls Handle before building the payload on requests to HUMAN servers. You can set up to 10 custom parameters (custom_param1 through custom_param10).

The Handle method receives an HttpRequest.

Example
...
customParametersHandler="CustomParamsImpl"
...
Handler example
namespace myUniqueApp
{
public class CustomParamsImpl : ICustomParametersHandler
{
public CustomParameters Handle(HttpRequest httpRequest)
{
CustomParameters customParams = new CustomParameters();
customParams.custom_param1 = "example";
customParams.custom_param2 = "example2";
return customParams;
}
}
}

Custom user agent header

useragentOverride
string

Header name that contains the client user agent. If unset, the Enforcer uses the incoming request’s User-Agent header.

Example
...
useragentOverride="px-user-agent"
...

Custom verification handler

customVerificationHandler
string

Class name of an IVerificationHandler implementation. When set, the Enforcer calls this handler instead of the default verification behavior so you can customize handling based on the risk score and context.

The Handle method receives:

  • HttpApplication application: Current ASP.NET application. Calling CompleteRequest ends the request pipeline after the current event.
  • PxContext pxContext: HUMAN context with fields such as Score, UUID, and BlockAction. You can also read data enrichment from pxContext when pxContext.IsPxdeVerified is true.
  • PxModuleConfigurationSection pxConfig: Current Enforcer configuration.
Example
...
customVerificationHandler="UniqueVerificationHandler"
...
Handler example
namespace myUniqueApp
{
public class UniqueVerificationHandler : IVerificationHandler
{
public void Handle(HttpApplication application, PxContext pxContext, PxModuleConfigurationSection pxConfig)
{
if (pxContext.IsPxdeVerified)
{
dynamic pxde = pxContext.Pxde;
// Use data enrichment as needed
}
if (pxContext.Score >= pxConfig.BlockingScore)
{
PxModule.BlockRequest(pxContext, pxConfig);
application.CompleteRequest();
}
}
}
}

Enforced routes

These configurations let you define specific routes that should be enforced under certain conditions.

mitigationUrls
comma-delimited list of strings

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

Matching routes go through the full Enforcer workflow, including blocking when necessary.

Compare paths to Request.Url.AbsolutePath with the leading / removed. For example, configure login to match /login. This is an exact match, not a prefix match.

Example
...
mitigationUrls="login,checkout"
...
enforceSpecificRoutes
comma-delimited list of strings

When this list is non-empty, the Enforcer runs only on request paths that start with one of the configured prefixes. All other routes are skipped.

Example
...
enforceSpecificRoutes="/protect/route,/login,/checkout"
...

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.

fileExtWhitelist
comma-delimited list of stringsDefaults to .axd,.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,.jar

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.

Example
...
fileExtWhitelist=".css,.js,.png,.jpg"
...
ipWhitelist
comma-delimited list of strings

Filters out requests with the specified IP address to avoid unnecessary traffic in the Enforcer verification flow.

The request IP is resolved with the same logic as detection (socketIpHeader when configured, otherwise the request socket IP). IPv4 and IPv6 are supported.

Example
...
ipWhitelist="127.0.0.1,10.0.0.0/24"
...
routesWhitelist
comma-delimited list of strings

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. Primitive string values are treated as path prefixes. For example, /login also matches /login/callback. That is, it uses exact prefix matching on the route via StartsWith().

Does not support regex and is case-sensitive.

Example
...
routesWhitelist="/health,/assets"
...
useragentsWhitelist
comma-delimited list of strings

Filters out requests with the specified user agent to avoid unnecessary traffic in the Enforcer verification flow. Primitive string values are case-sensitive and require an exact user-agent string.

Example
...
useragentsWhitelist="GoogleBot,MyInternalMonitor/1.0"
...

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.

First party is enabled by default. If firstPartyEnabled and firstPartyXhrEnabled are omitted from your pxModuleConfigurationSection, the Enforcer handles first-party requests.

When enabled, the Enforcer responds to first-party requests on routes derived from your Application ID without the PX prefix:

  • /<APP_ID_WITHOUT_PX>/init.js
  • /<APP_ID_WITHOUT_PX>/xhr/*

For example, if the application ID is PX12345678, first-party routes take the form /12345678/*.

After enabling first party on the Enforcer, complete the steps in Integrate 1st-Party JS Snippet so your snippet serves the JavaScript Sensor via first party.

Both attributes must be set to false to disable first party.

firstPartyEnabled
booleanDefaults to true

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

Example
...
firstPartyEnabled="true"
...
firstPartyXhrEnabled
booleanDefaults to true

Whether first-party XHR activity reverse-proxy routes are enabled.

Example
...
firstPartyXhrEnabled="true"
...

HUMAN Challenge customization

These configurations let you customize the HUMAN Challenge block page

cssRef
string

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

Example
...
cssRef="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
...
jsRef
string

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

Example
...
jsRef="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"
...
string

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

Example
...
customLogo="https://s.perimeterx.net/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 monitorMode is false. 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.

monitoredRoutes
comma-delimited list of strings

Exact request paths treated as monitor mode even when the Enforcer is actively blocking elsewhere.

Compare paths to Request.Url.AbsolutePath with the leading / removed. For example, configure home to match /home. This is an exact match, not a prefix match.

Example
...
monitoredRoutes="home,user"
...

Send activities

sendPageActivities
booleanDefaults to true

Whether to send asynchronous page_requested activities. Sending these activities does not block the request.

Example
...
sendPageActivities="true"
...
sendBlockActivities
booleanDefaults to true

Whether to send asynchronous block activities.

Example
...
sendBlockActivities="true"
...

Sensitive headers removal

sensitiveHeaders
comma-delimited list of stringsDefaults 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.

Example
...
sensitiveHeaders="cookie,cookies,x-auth-token"
...

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.

Primitive string values are treated as path prefixes. For example, /login also matches /login/callback.

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

sensitiveRoutes
comma-delimited list of strings

A list of prefixes for all routes that should be considered sensitive.

Example
...
sensitiveRoutes="/login,/user/profile"
...