Test Block Flow on Monitoring Mode - Bypass Monitor Header
  • 11 May 2023
  • Dark
    Light

Test Block Flow on Monitoring Mode - Bypass Monitor Header

  • Dark
    Light

Article Summary

Allows you to test the Enforcer’s blocking flow while you are still in Monitor Mode.

When the px_custom_check_bypass_monitor_header subroutine is implemented and the configured request header (my-custom-header in the example) has the value set to 1, then when there is a block response (for example from using a User-Agent header with the value of PhantomJS/1.0) the Monitor Mode is bypassed and full Block Mode is applied. If one of the conditions is missing you will stay in Monitor Mode. This is done per request.
To stay in Monitor Mode, set the header value to 0.

Implementation Example:

# px_custom.vcl:
sub px_custom_check_bypass_monitor_header {
  if (req.http.my-custom-header-name == "1") {
    set req.http.X-PX-config:enable-bypass-monitor-header = "1";
  }
}

Was this article helpful?