Setting up Edge WAF deployments using the Next-Gen WAF API
- English
- 日本語
IMPORTANT: This guide only applies to customers who want to deploy the Edge WAF on a Compute service and cannot 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 doesn't have the
ngwaf_oob_enabledparameter set. - The service has the
ngwaf_oob_enabledparameter disabled (false) and uses mutual TLS (mTLS).
If you don't meet these requirements, refer to the Fastly control panel guide instead.
The Edge WAF deployment method allows you to add the Next-Gen WAF as an edge security service onto Fastly's Edge Cloud platform using both CDN and Compute services.
- CDN service
- Compute service
To deploy the Next-Gen WAF on an existing CDN service, complete the following steps:
- Contact Fastly support to enable Edge WAF deployment for your account (corp).
- Create the edge security service, which invokes the Edge WAF.
- Map your account (corp) and workspace (site) to an existing Fastly CDN service and synchronize the origins. Privileged dynamic snippets that enable inspection are added to your CDN service.
To deploy the Next-Gen WAF on an existing Compute service, complete the following steps:
- Create the edge security service, which invokes the Edge WAF.
- Update the inspect function of your Rust code to authorize your service to make calls to the Edge WAF.
Prerequisites
Before setting up an Edge WAF deployment, be sure you have the necessary prerequisites in place.
Limitations and considerations
Keep in mind the following things when working with the Edge WAF deployment method:
- Adding the Next-Gen WAF via the Edge WAF deployment method to an existing Fastly CDN service counts against the service chain limit.
- We automatically support VCL directors on CDN services as long as they are defined using the Fastly API.
Creating the edge security service
IMPORTANT: Do you have access to the Next-Gen WAF in the Fastly control panel? If so, follow the instructions on the Edge WAF deployment using the Fastly control panel guide instead.
Create a new edge security service by calling the Edge WAF deployment API endpoint. This API call creates a new edge security service associated with your account (corp) and workspace (site). You will need to replace ${corpName} and ${siteName} with those of the account (corp) and workspace (site) you are adding the edge security service to. Your ${corpname} and ${siteName} are both present in the address of your Next-Gen WAF control panel, such as https://dashboard.signalsciences.net/corps/${corpName}/sites/${siteName}.
- CDN service
- Compute service
$ curl -X PUT "https://dashboard.signalsciences.net/api/v0/corps/${corpName}/sites/${siteName}/edgeDeployment" \-H "x-api-user:${SIGSCI_EMAIL}" \-H "x-api-token:${SIGSCI_TOKEN}" \-H "Content-Type: application/json"$ curl -X PUT "https://dashboard.signalsciences.net/api/v0/corps/${corpName}/sites/${siteName}/edgeDeployment" \-H "x-api-user:${SIGSCI_EMAIL}" \-H "x-api-token:${SIGSCI_TOKEN}" \-H "Fastly-Key: ${FASTLY_KEY}" \-H "Content-Type: application/json" \-d '{"authorizedServices": [ "${fastlySID}" ] }'Run this API call again for each workspace (site) you want to deploy on.
If successful, you will receive an HTTP 200 response with a blank response body ({}). To confirm the Next-Gen WAF instance resources associated with the workspace (site) have been created, query the edgeDeployment endpoint again using the following request:
$ curl -H "x-api-user:${SIGSCI_EMAIL}" -H "x-api-token:${SIGSCI_TOKEN}" \-H "Content-Type: application/json" \"https://dashboard.signalsciences.net/api/v0/corps/${corpName}/sites/${siteName}/edgeDeployment"The query should now return the appropriate Next-Gen WAF instance associated with the Next-Gen WAF workspace (site) in the URL path with no services attached. To attach the appropriate service, refer to Mapping to the Fastly service.
{"AgentHostName":"se--${corpName}--{SiteUID}.edgecompute.app","ServicesAttached":[]}IMPORTANT: If you're using Next-Gen WAF with a Compute service, your next step would be to update your Rust code to call Next-Gen WAF via an inspect function. If you're using a CDN service, continue with the steps below to map your account (corp) and workspace (site) to a Fastly CDN service and synchronize the origins.
Mapping to a Fastly CDN service
To map your account (corp) and workspace (site) to an existing Fastly CDN service and synchronize the origins, follow these steps:
Using the curl command line tool, call the PUT deliveryIntegration/${fastlySID} API endpoint in a terminal application:
- Unix-based
- Windows-based
$ curl -H "x-api-user:${SIGSCI_EMAIL}" -H "x-api-token:${SIGSCI_TOKEN}" \-H "Fastly-Key: ${FASTLY_KEY}" -H 'Content-Type: application/json' -X PUT \"https://dashboard.signalsciences.net/api/v0/corps/${corpName}/sites/${siteName}/deliveryIntegration/${fastlySID}"$ curl -H "x-api-user:${SIGSCI_EMAIL}" -H "x-api-token:${SIGSCI_TOKEN}" \-H "Fastly-Key: ${FASTLY_KEY}" -H "Content-Type: application/json" -X PUT \"https://dashboard.signalsciences.net/api/v0/corps/${corpName}/sites/${siteName}/deliveryIntegration/${fastlySID}"This API call will create and activate a new service version with dynamic VCL snippets automatically added to the service. By default, the service will be activated and set to 0% traffic ramping. You can override those defaults by providing parameters in the JSON body:
activateVersion- activate Fastly service version after clone. Possible values aretrueorfalse(unquoted). If not specified, defaults totrue.percentEnabled- percentage of traffic to send to the Next-Gen WAF. Possible values are integers values0to100(unquoted). If not specified, defaults to0. This can be adjusted later. Check out Traffic ramping for details.
For example, to disable initial activation and set initial traffic ramping to 10%, add the curl parameter
-d '{"activateVersion": false, "percentEnabled": 10}'to the usual call:$ curl -H "x-api-user:${SIGSCI_EMAIL}" -H "x-api-token:${SIGSCI_TOKEN}" \-H "Fastly-Key: ${FASTLY_KEY}" -H 'Content-Type: application/json' -X PUT \-d '{"activateVersion": false, "percentEnabled": 10}' \"https://dashboard.signalsciences.net/api/v0/corps/${corpName}/sites/${siteName}/deliveryIntegration/${fastlySID}"This API call requires the Fastly-Key header for authentication. The Fastly API key must have write access to the Fastly service ID. This API call will create and activate a new service version with dynamic VCL snippets automatically added to the service.
Optionally, follow these steps again for each additional Fastly service that you want to deploy on.
If your origins change, you will need to call the PUT deliveryIntegration/${fastlySID}/backends API endpoint again to resynchronize the backends.
WAF execution for CDN services
Once both API calls are completed, your service will automatically be set up with dynamic VCL snippets that control the execution of the Next-Gen WAF. A new service version will be created and activated containing the additional VCL snippets.