Custom Params

Overview

Custom params allow you to enrich activities sent to from your Enforcer to PerimeterX with additional data.
This data can include user or session IDs, and other data that PerimeterX should have access to. There is a limit of 10 custom params.

Custom params are added as HTTP headers to the requests in the following format:

X-PX-custom-param#, where # is replaced with numbers 1 - 10

(e.g., X-PX-custom-param1, X-PX-custom-param2, … up to X-PX-custom-param10).

You must set custom params both in the PerimeterX Portal and in the VCL code.

Setting Custom Params in the Portal

25472547
  1. In the PerimeterX Portal, navigate to Admin > Applications.
  2. Select the application you would like to edit custom params for.
  3. Open the Custom Parameters dropdown to see all custom parameters. You can add, edit, and delete custom params here.

Setting Custom Params in the VCL

To add custom params, you need to edit the subroutine px_custom_enrich_risk_custom_params under the file px_custom.vcl.

📘

This subroutine enriches the following requests:

  • Risk API
  • Page Requested
  • Block

Custom params example:

sub px_custom_enrich_risk_custom_params {
  # Generic example where <value> is any string
  set req.http.X-PX-custom-param1 = <value>;
  
  # Example with hardcoded string
  set req.http.X-PX-custom-param2 = "custom-data";
  
  # Example with data from other objects
  set req.http.X-PX-custom-param3 = re.group.1;
  
  # Example with local variable (declared, defined, and then set as custom param)
  declare local var.user STRING;
  set var.user = "username123";
  set req.http.X-PX-custom-param4 = var.user;
  
  # Example with string concatenation
  set req.http.X-PX-custom-param5 = "user" time.elapsed.msec;
}

Did this page help you?