Filter by IP
If you want to run internal tests from your office/site IP addresses, you can filter out requests originating from a specific IP address.
TO define an IP address you want to filter:
- Open the PX_CUSTOM.vcl fie.
- Add the required IP as a regex expression using req.http.Fastly-Client-IP.
EXAMPLE
sub px_custom_filter_by_ip {
if (req.http.Fastly-Client-IP ~ {"<filterd_ip_address_regex>"}) {
set req.http.X-PX-filter-by:ip = "1";
}
}
To learn more about custom subroutines, see Customized subroutines.
TO enable the feature:
- Open the PX_CONFIG.vcl file.
- Set the px_filter_by_ip_enabled value to "true" (enabled). The default is "false" (disabled).
table px_configs {
"px_filter_by_ip_enabled": "true",
}
Test
- Send a request that includes the filtered IP.
- Openthe console and search for your request. If you can't find the request, the feature is configured correctly.
Updated 12 days ago