Do more with AWS WAF labels using dynamic label interpolation
July 21, 2026 · AWS Security · Severity: MEDIUM
AWS WAF now offers dynamic label interpolation, a feature that simplifies the management of web traffic classification by allowing users to reference labels by namespace instead of individual names. This enhancement reduces the maintenance burden of enumerating each label, particularly as the catalog of labels grows. AWS WAF attaches metadata, such as labels indicating bot activity or credential-stuffing patterns, to each request it evaluates. These labels can be forwarded to backend systems as request headers, providing visibility into AWS WAF’s decisions. Additionally, labels can be used to build tiered policies, such as triggering CAPTCHA challenges for low-confidence bot signals or blocking high-confidence bot requests outright. The AWS WAF AI Activity Dashboard, launched on February 24, 2026, identifies over 650 bots and agents, including search engine crawlers and AI assistants, with the list continually expanding. Dynamic label interpolation uses a ${namespace:} syntax to resolve label values at evaluation time, enabling users to embed labels directly in custom responses, headers, or redirects. This feature supports synthetic labels derived from the request itself, such as client IP addresses, TLS fingerprints (JA3 and JA4), and AWS WAF request IDs. Users can mix synthetic labels with namespace-based labels in a single value, passing them to their backend systems in a format that suits their application. This capability is particularly useful for scenarios like forwarding classification data, building custom block pages, redirecting traffic, or segmenting Amazon CloudFront caches by bot category. The feature eliminates the need for new API fields, as the syntax is integrated into existing string values, ensuring backward compatibility and streamlined implementation.
AWS WAF classifies web traffic by attaching metadata to each request it evaluates. Managed rule groups such as AWS WAF Bot Control and AWS WAF Fraud Control account takeover prevention (ATP) attach labels that describe what they found. A label can record that a request came from a known bot category or that it matched a credential-stuffing pattern. You can forward that metadata to your origin as request headers, which gives your backend visibility into the decisions AWS WAF made at the edge. You can also use labels to build tiered policies: a low-confidence bot signal might trigger a CAPTCHA challenge, whereas a high-confidence signal blocks the request outright.
With the AWS WAF AI Activity Dashboard, launched February 24, 2026, Bot Control now identifies more than 650 bots and agents, including search engine crawlers, data collectors, AI assistants, and large language model (LLM) training crawlers, which is ever increasing over time. In an earlier post, we showed how to group Bot Control labels into confidence levels and use them to drive adaptive user experiences in your application. That approach works well when you can list the labels you care about. After the catalog grows past what you can reasonably enumerate, writing a rule for each label becomes a maintenance burden and consumes rule capacity you’d rather spend elsewhere.
With dynamic label interpolation, you can reference labels by namespace instead of by individual name, so a single rule resolves to whichever labels matched during evaluation with no requirement to enumerate each one. You write a ${namespace:} clause in a header value or custom response body, and AWS WAF substitutes the matched values at evaluation time. The feature also gives you synthetic labels you can embed directly in responses, including the client IP address, request JA3 and JA4 fingerprints, and WAF request ID. The rest of this post explains how interpolation resolves labels by referencing four scenarios: forwarding classification data to your application, building custom block and challenge pages, redirecting traffic to a verification step, and segmenting Amazon CloudFront caches by bot category.
Interpolation syntax and behavior
Dynamic label interpolation uses a ${namespace:} syntax that resolves label values at evaluation time. You can use it in three places:
| Where | What it does | Syntax |
| Custom request headers | Inserts resolved label values into headers that AWS WAF forwards to your origin. For example, set X-Bot-Category to so your application receives the matched bot category directly. | in the header value field |
| Custom response bodies | Embeds label values and synthetic labels (such as client IP or request ID) in block pages, challenge pages, and other custom responses. | in the response body Content field |
| Custom response headers | Insert label values into response headers (for example, Location for redirects). | in the response header Value field |
In each case, AWS WAF reads the labels attached to the request and substitutes the resolved values into the string you provide.
The interpolation syntax
Include a ${namespace:} clause anywhere you would normally put a header value or custom response body. The trailing colon is what signals interpolation, telling AWS WAF to resolve every label in that namespace rather than match a single named label. AWS WAF evaluates each clause against the labels on the request and follows three rules:
- Single match – The clause resolves to the label’s terminal value. If the request carries
awswaf:managed:aws:bot-control:bot:category:scraping, then${awswaf:managed:aws:bot-control:bot:category:}resolves to
scraping. - Multiple matches – AWS WAF strips the namespace prefix and returns the values as a comma-separated list, such as
scraping,advertising. - No match – The clause resolves to an empty string.
This is backward compatible. AWS WAF only interpolates a value when it contains a ${...} clause, so anything else passes through unchanged. There are no new API fields to set because the syntax is written directly into your existing string values. AWS WAF label namespaces are already colon-delimited (for example, awswaf:managed:aws:bot-control:bot:category:), meaning the required trailing colon won’t collide with header values that don’t follow that pattern.
Synthetic labels
Not every value you might want comes from a rule match. Synthetic labels are derived from the request itself, such as the client’s IP address, the AWS WAF request ID, or the TLS fingerprint, and you interpolate them with the same syntax.
| Synthetic label | Description |
| ${awswaf:request_id:} | The unique AWS WAF request identifier |
| ${awswaf:ip:} | The client IP address |
| ${awswaf:ja3:} | The JA3 TLS fingerprint |
| ${awswaf:ja4:} | The JA4 TLS fingerprint |
Because synthetic labels work everywhere ${namespace:} interpolation does, you can mix them with namespace-based labels in a single value and pass both to your origin in whatever format suits your application.
The following examples use Bot Control labels, but interpolation isn’t limited to them. It works with most namespaces including labels from other AWS Managed Rules, such as account takeover prevention, account creation fraud prevention, and the IP reputation and anonymous IP lists, as well as labels from AWS Marketplace managed rule groups. This works with labels you custom define based on your own requirements in your own rules.
The same applies to custom labels you define in your own rules. Consider a configuration that classifies requests into tiers based on an API ke
Key Takeaways
- AWS WAF labels attach metadata to requests for traffic classification.
- Dynamic label interpolation enables tiered policy actions based on confidence.
- Bot Control now identifies over 650 bots and agents for better detection.