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.

  1. Bot Management
  2. 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.

Limitations and considerations

When working with client challenges, keep the following things in mind:

  • Don't manipulate the Set-Cookie response header or the Cookie request 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-store response 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.com does not validate requests to api.example.com. If your application loads cross-domain resources on the same service (e.g., a page on www.example.com calls api.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-BOT signal 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:

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.

  1. Bot Management (pre-cache inspection)
  2. Bot Management (post-cache inspection)
  3. 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.

  1. Log in to the Fastly control panel.
  2. Go to Security > Bot Management > Protection.

  3. From the services menu, select the appropriate service.
  4. 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.

  1. Log in to the Fastly control panel.
  2. Go to Security > Bot Management > Settings.
  3. From the services menu, select the appropriate service.
  4. 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.