Getting started with client challenges
Client challenges are security tasks that verify users are human or accessing your web application through a legitimate browser. You can use them with our Bot Management or Fastly DDoS Protection product to block unwanted bot traffic.
Prerequisites
Before you set up client challenges, select the tab for the product you want to use and make sure you meet the requirements.
- Bot Management
- DDoS
Before setting up client challenges for Bot Management, you must:
- purchase the required products for your Bot Management deployment option. Pre-cache inspection requires Bot Management. Post-cache inspection requires Bot Management and Next-Gen WAF (Edge WAF deployment only).
- deploy Bot Management on each CDN service where you intend to use client challenges. Compute services are not supported.
Before setting up client challenges for Fastly DDoS Protection, you must purchase Fastly DDoS Protection for your account.
Limitations and considerations
When working with client challenges, keep the following things in mind:
- Don't manipulate the
Set-Cookieresponse header or theCookierequest header in VCL, as these headers are essential for identifying initiated and solved challenges via the_fs_ch_st_<RANDOM STRING>and_fs_ch_cp_<RANDOM_STRING>cookies. - Don't cache the client challenge response. By default, Fastly honors the
Cache-Control: private, no-storeresponse header set on challenge responses, but custom VCL or configuration that overrides this behavior will cause errors for users attempting to access the challenged page. - Private Access Token (PAT) challenges can only be issued to Apple-supported devices using iOS 16 or higher or macOS Ventura or higher.
- Client challenges may fail to load due to browser extensions, network issues, or restrictive settings, such as disabled cookies or blocked scripts. To resolve this, ask users to check their connection, disable ad blockers, or try a different browser.
Additionally, if you've deployed Bot Management with post-cache inspection, keep in mind the following:
- Challenge success cookies are scoped to fully-qualified domain names (FQDN). For example, solving a challenge on
www.example.comdoes not validate requests toapi.example.com. If your application loads cross-domain resources on the same service (e.g., a page onwww.example.comcallsapi.example.com), applying the same challenge rule to all hostnames will fail. To prevent this, restrict challenge rules to specific hostnames. - To exclude a bot from client challenges when you want it to access your website, you must include that bot in a rule condition (e.g., set up a rule condition excluding clients with the
VERIFIED-BOTsignal from client challenges).
Quick start
To protect your web application from unwanted bot traffic, you can configure Bot Management or Fastly DDoS Protection to issue client challenges. While Fastly offers different types of challenges depending on the product you're using, this section only covers the steps for serving dynamic challenges on interstitial pages.
HINT: Don't want to serve dynamic challenges to an interstitial page? Try one of these options instead:
- embed a dynamic challenge in a React or single-page application.
- send only interactive or non-interactive challenges if you've deployed Bot Management with post-cache inspection.
With a dynamic challenge, Fastly chooses the most-appropriate type of challenge to send to the client. To minimize disruption to your application's user experience, Fastly will only serve interactive challenges (e.g., CAPTCHA) when suspicious activity is detected. Otherwise, Fastly will send non-interactive challenges (e.g., JavaScript proof-of-work).
To set up client challenges, select the tab for the product you want to use and follow the instructions.
- Bot Management (pre-cache inspection)
- Bot Management (post-cache inspection)
- DDoS
If you've deployed Bot Management with pre-cache inspection (ContentGuard), start by selecting the bot categories or identities you want to challenge. Bot Management groups bots into categories (e.g., search engines, AI crawlers). Within each category, individual bots are tracked as identities (e.g., Googlebot). You can set actions at either level.
- Log in to the Fastly control panel.
Go to Security > Bot Management > Protection.
- From the services menu, select the appropriate service.
In the row of the bot category that you'd like to configure protection for, do one of the following:
- From the Action menu, select Challenge. Fastly will challenge all bot identities that are included in that category.
- Click Configure bots and then from the Action menu for the relevant bot identities, select Challenge. Fastly will challenge these bots.
Next, change your Protection mode to Block (Active enforcement) to enforce the bot category and identity actions you selected on the Protection page.
- Log in to the Fastly control panel.
- Go to Security > Bot Management > Settings.
- From the services menu, select the appropriate service.
- From the Protection mode menu, select Block (Active enforcement).
After setting up Bot Management to challenge select bot categories and identities, you can optionally:
- add a custom logo to the interstitial page where the challenge will be served.
- configure the challenge to be embedded within a page of your web application, rather than served on an interstitial page.
If you've deployed Bot Management with post-cache inspection (Next-Gen WAF), you can protect specific endpoints with a dynamic challenge by creating rules in the Next-Gen WAF that do the following:
- Send the challenge.
- Verify the challenge token.
- Block requests with invalid tokens.
The following instructions show how to set up these rules for www.example.com/login. Be aware that this example uses values (e.g., hostnames and paths) that may not be the same as those used by your particular web application.
Send the challenge
First, create a rule that challenges all traffic destined for www.example.com/login:
- Log in to the Fastly control panel.
- Go to Security > Next-Gen WAF > Rules.
- From the workspaces bar, click the menu to the right of the workspace name and select a workspace.
Click Add workspace rule.
In the Type area, select Request.
In the Conditions area, define where the rule should send the challenge. For example, to send a challenge to all request traffic destined for
www.example.com/login, create the following conditions:Condition Field Operator Value 1 Method Equals GET 2 Domain Equals www.example.com3 Path Equals /loginIn the Actions area, select Dynamic challenge from the Action type menu.
Fill out the fields in the Details area as follows:
- In the Description field, enter a description for the rule.
- Leave the Status switch for the rule enabled.
Click Create workspace rule.
Verify the token
Next, create a rule to verify whether clients have a valid token from correctly solving a challenge. You need to create this rule so that you can block requests with invalid tokens in the next step.
Click Add workspace rule.

Add the following three conditions to ensure the WAF only applies this rule to HTTP POST requests where the domain is
www.example.comand the request path is/login.Condition Field Operator Value 1 Method Equals POST 2 Domain Equals www.example.com3 Path Equals /loginAdd the following condition to ensure the WAF does not apply this rule to requests made by verified bots.
- From the first Field menu, select Signal.
- From the first Operator menu, select Does not exist where.
- From the second Field menu, select Signal ID.
- From the second Operator menu, select Equals.
- From the Value menu, select Verified Bot.
From the Type menu in the Actions section, select Verify token to check whether the client has successfully solved a challenge on a previous request.
In the Description field, enter
Verify token on POST requests to www.example.com/login.Click Create workspace rule.
Block requests with invalid tokens
IMPORTANT: Before creating this rule, create a custom signal named Login attempt with invalid token.
Finally, create a rule to block requests from clients that don't have a valid token:
Click Add workspace rule.

Add the following three conditions to ensure the WAF only applies this rule to HTTP POST requests where the domain is
www.example.comand the request path is/login.Condition Field Operator Value 1 Method Equals POST 2 Domain Equals www.example.com3 Path Equals /loginAdd the following conditions to ensure the WAF only applies this rule to requests tagged with the
CHALLENGE-TOKEN-INVALIDsignal.- From the first Field menu, select Signal.
- From the first Operator menu, select Exists where.
- From the second Field menu, select Signal ID.
- From the second Operator menu, select Equals.
- From the Value menu, select Challenge Token Invalid.
From the Type menu in the Actions section, select Block.
Click Add action. New menus appear.
From the new Action type menu, select Add signal and from the Signal menu, select the
Login attempt with invalid tokencustom signal.In the Description field, enter
Block requests to www.example.com/login when the client hasn't solved a previous challenge..Click Create workspace rule.
After setting up Bot Management to use client challenges to protect an endpoint, you can optionally add a custom logo to the interstitial page where the challenge will be served.
To start issuing dynamic challenges to clients that DDoS Protection identifies as attack traffic, follow these 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.
- In the Security area, click the DDoS Protection switch to On to immediately enable DDoS Protection for this service.
- From the Protection mode menu, select Challenge.
After setting up Fastly DDoS Protection to challenge attack traffic, you can optionally:
- add a custom logo to the interstitial page where the challenge will be served.
- configure the challenge to be embedded within a page of your web application, rather than served on an interstitial page.
- override the protection mode for specific rules
Related content
- Bot Management (pre-cache inspection)
- Bot Management (post-cache inspection)
- DDoS
