How client challenges work
Client challenges verify that a request comes from a legitimate browser or a human user, not an automated script. This guide explains the types of challenges Fastly can send, how they're presented to users, and the request flow when a client receives and solves a challenge.
Challenge types
Depending on the product that you're using, you can configure Fastly to send three types of challenges:
| Challenge type | Description | Purpose | Supported products |
|---|---|---|---|
| Dynamic challenge | Fastly automatically selects the most appropriate client challenge based on the situation. These may include Private Access Tokens (PATs), non-interactive challenges, or interactive challenges if suspicious activity is detected during the initial check. | Fastly adapts the challenge to match the risk level without manual configuration. |
|
| Non-interactive challenge | Client solves a JavaScript proof-of-work, which is essentially a JavaScript math problem. | Proves the client is running a JavaScript-compatible browser. |
|
| Interactive challenge | Client is prompted with a random alphanumeric string and must enter it into a box. This type is also known as a CAPTCHA challenge. | Proves the client requesting the information is human. |
|
Challenge presentation methods
Fastly can present challenges in two ways:
- Embedded within a page: The challenge is integrated into a page of your web application, ensuring the branding and user experience of your web application remains consistent. This method only supports dynamic challenges and requires you to modify the HTML of your webpage.
- Served on an interstitial page: The challenge is hosted on a temporary page before loading the requested content. This method supports all challenge types and doesn't require you to modify the code of your web application.
Dynamic challenge flow
How Fastly handles dynamic challenges depends on the product you're using.
- DDoS and Bot Management (pre-cache inspection)
- Bot Management (post-cache inspection)
If you've configured dynamic challenges with DDoS or Bot Management (pre-cache inspection), Fastly sends a Private Access Token (PAT) challenge to the client when it receives a request. If the client solves the PAT challenge, Fastly issues a token, which the client stores as a browser cookie. This token defaults to a 1-hour expiration.
If the client fails the PAT challenge, Fastly returns a 401 Unauthorized response. This response is visible in browser developer tools but handled transparently. Fastly then issues a non-interactive challenge. What happens next depends on the result:
- If the client solves the challenge and Fastly doesn't detect a headless browser, Fastly issues a token.
- If the client solves the challenge but Fastly detects headless browser activity, Fastly issues interactive challenges until the client succeeds. Once successful, Fastly issues a token.
- If the client fails the challenge, Fastly sends another non-interactive challenge.
If you've configured dynamic challenges with Bot Management (post-cache inspection), Fastly sends a Private Access Token (PAT) challenge to the client when it receives a request. Fastly also tags the request with the Challenged Request (CHALLENGED) signal.
If the client solves the PAT challenge, Fastly tags the request with the Challenge Token Valid (CHALLENGE-TOKEN-VALID) signal and issues a token, which the client stores as a browser cookie. This token defaults to a 1-hour expiration.
If the client fails the PAT challenge, Fastly returns a 401 Unauthorized response. This response is visible in browser developer tools but handled transparently. Fastly then issues a non-interactive challenge. What happens next depends on the result:
- If the client solves the challenge and Fastly doesn't detect a headless browser, Fastly tags the request with the Challenge Token Valid signal and issues a token.
- If the client solves the challenge but Fastly detects headless browser activity, Fastly issues interactive challenges until the client succeeds. Once successful, Fastly tags the request with the Challenge Token Valid signal and issues a token.
- If the client fails the challenge, Fastly sends another non-interactive challenge.
HINT: Want to block requests that don't have a valid challenge token? Check out our Blocking requests with invalid challenge tokens guide.