Edge WAF deployment using the Fastly control panel
- English
- 日本語
IMPORTANT: This guide only applies to customers who want to deploy the Edge WAF on a Compute service and can access the Next-Gen WAF in the Fastly control panel or want to deploy the Edge WAF on a CDN service that meets one of the following conditions:
- The service has the
ngwaf_oob_enabledparameter disabled (false) and doesn't use mutual TLS (mTLS). - The service has the
ngwaf_oob_enabledparameter enabled (true). When this condition is met, it doesn’t matter if the service uses or doesn’t use mTLS.
If you don't meet these requirements, refer to the Next-Gen WAF control panel guides instead.
The Edge WAF deployment method hosts the Next-Gen WAF on Fastly’s Edge Cloud platform via our global network of POPs, integrates with Fastly’s caching layer, and is managed by Fastly. Since security processing happens at the edge, the Next-Gen WAF can inspect all traffic before it enters your origin infrastructure and block attacks close to where they originated. You do not need to make any modifications to your own hosting environment.
Prerequisites
Before setting up an Edge WAF deployment, be sure you have the necessary prerequisites in place.
Limitations and considerations
When enabling the Next-Gen WAF for your services, keep the following in mind:
- Enabling, disabling, or making changes to Fastly Next-Gen WAF on a service immediately impacts all service versions, including the active one.
- A service can be linked to a maximum of one workspace. A workspace can be linked to multiple services.
- Only users assigned the superuser role can enable and configure the Edge WAF deployment for services.
Additionally, if you're deploying the Next-Gen WAF on a CDN service, keep the following in mind:
- Adding the Next-Gen WAF to an existing CDN service counts against the service chain limit.
- Updates made to your origins in the Fastly control panel are automatically synched to the Edge WAF. This means you never need to manually synchronize your origins.
Setting up the deployment
- Fastly control panel
- Fastly Products API
To deploy the Next-Gen WAF on an existing CDN or Compute service, complete the following steps:
- Log in to the Fastly control panel.
- From the Home page, select the appropriate service. You can use the search box to search by ID, name, or domain.
Click Service configuration and then Security.
Click the Next-Gen WAF switch to the On position.

In the confirmation window, click Enable on all versions. Next-Gen WAF is immediately enabled on all versions.
(Optional) Use attack tooling to verify that the Next-Gen WAF is monitoring your web application and identifying malicious and anomalous requests.
HINT: Have a Compute service? Deploy the Next-Gen WAF on your service using the Fastly control panel instructions.
To deploy the Next-Gen WAF on an existing CDN service using the Fastly API, you will need the Fastly-Key header for authentication. Your Fastly API key must have write access to the relevant CDN service.
Using the curl command line tool, call the enable a product API endpoint in a terminal application to enable the Next-Gen WAF on your service and link your service to a workspace:
$ curl -H "Fastly-Key: ${FASTLY_API_TOKEN}" -H 'Content-Type: application/json' -X PUT \-d '{"workspace_id": "${NGWAF_WORKSPACE_ID}"}' \"https://api.fastly.com/enabled-products/v1/ngwaf/services/${FASTLY_SERVICE_ID}"(Optional) Using the curl command line tool, call the configure a product API endpoint in a terminal application to change the amount of traffic the Next-Gen WAF inspects. When the value is set to
100, all traffic (100%) is inspected. When the value is less than100, a random sample of the specified percentage is inspected. By default, the Next-Gen WAF inspects all traffic.$ curl -H "Fastly-Key: ${FASTLY_API_TOKEN}" -H 'Content-Type: application/json' -X PATCH \-d '{"workspace_id": "${NGWAF_WORKSPACE_ID}", "traffic_ramp": 20}' \"https://api.fastly.com/enabled-products/v1/ngwaf/services/${FASTLY_SERVICE_ID}/configuration"(Optional) Use attack tooling to verify that the Next-Gen WAF is monitoring your web application and identifying malicious and anomalous requests.
Configuring the deployment
- Fastly control panel
- Fastly Products API
To update your deployment on a CDN or Compute service, complete the following steps:
- Log in to the Fastly control panel.
- From the Home page, select the appropriate service. You can use the search box to search by ID, name, or domain.
Click Service configuration and then Security.
Fill out the following deployment settings on the Next-Gen WAF card.
HINT: If the Next-Gen WAF is already enabled, click the pencil to edit the settings and then Submit to save the updated values.
- From the Workspace menu, select the workspace that you want to link to the service. If your account only has one workspace, this field is read-only.
- (CDN services only) In the % of traffic field, enter the percent of traffic that you want the Next-Gen WAF to inspect. When set to
100, all traffic to your service is inspected. When the value is less than 100, a random sample of the specified percentage is inspected.

Click Save.
(Optional) Use attack tooling to verify that the Next-Gen WAF is monitoring your web application and identifying malicious and anomalous requests.
HINT: Have a Compute service? Configure the deployment using the Fastly control panel instructions.
Using the curl command line tool, call the configure a product API endpoint in a terminal application to configure your Edge WAF deployment on a CDN service. The endpoint requires that you include the Fastly-Key header for authentication and at least one of the following parameters in the JSON body:
workspace_id: the ID of the workspace that you want to link to the service.traffic_ramp: the percentage of traffic that the Next-Gen WAF inspects. When the value is set to100, all traffic (100%) is inspected. When the value is less than100, a random sample of the specified percentage is inspected. By default, the Next-Gen WAF inspects all traffic.
$ curl -H "Fastly-Key: ${FASTLY_API_TOKEN}" -H 'Content-Type: application/json' -X PATCH \-d '{"workspace_id": "${NGWAF_WORKSPACE_ID}", "traffic_ramp": 20}' \"https://api.fastly.com/enabled-products/v1/ngwaf/services/${FASTLY_SERVICE_ID}/configuration"Disabling the deployment
To disable Edge WAF deployment for a CDN or Compute service, complete the following steps.
- Fastly control panel
- Fastly Products API
- Log in to the Fastly control panel.
- From the Home page, select the appropriate service. You can use the search box to search by ID, name, or domain.
- Click Service configuration and then Security.
- In the Next-Gen WAF card, set the Next-Gen WAF to the Off position.
- In the confirmation window, click Disable on all versions.
To disable Edge WAF deployment for a CDN service using the curl command line tool, call the disable a product API endpoint in a terminal application.
HINT: To disable the Next-Gen WAF via the Fastly API, you will need the Fastly-Key header for authentication. The Fastly API key must have write access to the relevant service.
$ curl -H "Fastly-Key: ${FASTLY_API_TOKEN}" -H 'Content-Type: application/json' -X DELETE \"https://api.fastly.com/enabled-products/v1/ngwaf/services/${FASTLY_SERVICE_ID}"Disabling inspection
The waf.inspection.disabled VCL variable prevents the Next-Gen WAF from inspecting requests that meet user-defined conditions. For example, you can use this variable to bypass the WAF and allow traffic to access static content.
To disable inspection for select requests, create a VCL Snippet:
- Log in to the Fastly control panel.
- From the Home page, select the appropriate service. You can use the search box to search by ID, name, or domain.
- Click Edit configuration and then select the option to clone the active version.
Click VCL.
Click VCL snippets.
Click Add snippet.
Fill out the Add VCL snippet fields as follows:
Using the Type controls, select Regular to create a regular VCL snippet.
In the Name field, enter an appropriate name (e.g.,
Disable WAF inspection).Using the Placement controls, select Within subroutine.
From the Subroutine menu, select recv (
vcl_recv).(Optional) In the Priority field, enter the order in which you want the snippet to execute. Lower numbers execute first.
In the VCL editor, add the following code:
if (req.url.ext ~ "(?i)^(css|js|gif|png)") {set waf.inspection.disabled = true;}
Click Add to create the snippet.
- From the Activate menu, select Activate on Production to deploy your configuration changes.
