Enforced Routes
  • 16 May 2023
  • Dark
    Light

Enforced Routes

  • Dark
    Light

Article Summary

You may want certain requests to be enforced by HUMAN, even when the Enforcer is in the Monitor mode. These are enforced routes. Enforced routes will go through the full Enforcer workflow, including blocking requests when necessary. That is, even when the Enforcer is in the Monitor mode, these routes will behave as if in the Blocking mode.

TO define enforced routes:

  1. Open the PX_CUSTOM.vcl file.
  2. Modify the custom subroutine px_custom_enforced_routes. The subroutine evaluates the request path and sets the header X-PX-enforced-route to “1” to indicate that the request should be enforced, if needed.

EXAMPLE:

sub px_custom_enforced_routes {
  if (req.url.path ~ {"^/prefix|^/exact/match$"}) {
    set req.http.X-PX-enforced-route = "1";
  }
}

To learn more about custom subroutines, see Customized subroutines.

Only for v7.2.0 and below:

After defining the enforced routes, as explained above:

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

Was this article helpful?