Additional Activity Handler

The Additional Activity Handler is a callback function passed to the Enforcer. The Enforcer runs this callback after sending the page_requested or block activity to the Collector, and before forwarding the request to the next step in the pipeline. A common use case of the Additional Activity Handler is to set the score as a variable or header. Then the application can read the score and implement the application logic.

TO define the feature:

  1. Open the PX_CUSTOM.vcl file.
  2. Modify px_custom_additional_activity_handler to perform the required logic.

Example

sub px_custom_additional_activity_handler {
  set req.http.x-px-score = if(req.http.x-px-validated-request == "1", "0", "100");
}

TO enable the feature:

v.8.0.0 and up

  1. Open the PX_CONFIG.vcl file.
  2. Set the px_additional_activity_handler_enabled value to "true" (enabled). The default is "false" (disabled).
table px_configs {
  "px_additional_activity_handler_enabled": "true",
}

v7.2.0 and below

  1. Open the PX_CONFIG.vcl file.
  2. Set the PX_ENABLE_ADDITIONAL_ACTIVITY_HEADER value to "1" (enabled). The default is "0" (disabled).
table px_configs {
  "PX_ENABLE_ADDITIONAL_ACTIVITY_HEADER": "1",
}