Bot protection on Akamai EdgeWorkers
Run Centinel in your Akamai property as its own EdgeWorker or as a module in the one you already run. Cached pages stay cacheable.
How it fits into Akamai
- EdgeWorkers tier
- Dynamic Compute (Tier 200) or higher, created and activated in Akamai Control Center.
- Validator route
- A Property Manager rule forwards /centinel-validate to validator.centinelanalytica.com/validate with No Store caching.
- Cache preservation
- Requests are checked before the cache lookup and _centinel is added after it, so the cookie is never stored in the cache.
- Timeout and failure mode
- 500 ms by default (PMUSER_EW_CENTINEL_TIMEOUT). Validator errors, timeouts or a missing key fail open.
How a request moves through Akamai
The EdgeWorker validates before the cache lookup and adds the cookie after it, so one cached object serves every allowed visitor.
Rule match
The Centinel Protection rule skips 39 static file extensions. An optional Path criterion narrows it further. onClientRequest runs on what remains.
Validator subrequest
onClientRequest POSTs to /centinel-validate on your own hostname. The Centinel Validator rule rewrites the path to /validate and sends it to the validator origin.
Decision
Block and challenge respond from the edge. Allow continues to the cache lookup and your origin as normal.
onClientResponse
The EdgeWorker adds the _centinel cookie and Server-Timing: validator;dur=<ms> to the response. On error or timeout the request goes through unchanged.
Minimal configuration and a live check
Call Centinel from your own EdgeWorker
import * as centinel from "centinel";
export async function onClientRequest(request) {
await centinel.onClientRequest(request);
// Centinel responded: return, or a later respondWith() replaces it.
if (request.wasTerminated()) return;
// Your existing onClientRequest code.
}
export async function onClientResponse(request, response) {
centinel.onClientResponse(request, response);
// Your existing onClientResponse code, if any.
}Add Centinel to your bundle.json dependencies with its EdgeWorker ID and "version": "active". Centinel uses only these two handlers.
Check the timing header and cookie
curl -s -o /dev/null -D - -A 'Mozilla/5.0' https://www.example.com/ | grep -iE 'server-timing|set-cookie'Expect Server-Timing: validator;dur=<ms> and Set-Cookie: _centinel=... on a first visit. If Server-Timing is missing, GET /centinel-validate should return 405 (a 403 on POST means Allow POST is missing); if Server-Timing appears without _centinel, confirm PMUSER_BYPASS_EW_CLTRESP_EVENT is false.
Deployment options
Standalone EdgeWorker on your property
Upload main.js and bundle.json to a Tier 200 EdgeWorker, add the Centinel Validator rule and the Hidden PMUSER_EW_CENTINEL_SECRET_KEY variable, then attach the EdgeWorker to a Centinel Protection rule.
Standalone EdgeWorker guide (opens in a new tab)Inside an existing EdgeWorker
Akamai runs one EdgeWorker per request. With flexible composition, your EdgeWorker imports Centinel as a bundle.json dependency instead of a second behavior.
Flexible composition guide (opens in a new tab)
What to know before deploying
Keep the Centinel rules at the bottom of the tree
When two rules set the same behavior, the bottom-most match wins. A later origin or caching rule would otherwise override Centinel's.
Set variables to Hidden, not Sensitive
Mark PMUSER_EW_CENTINEL_SECRET_KEY and PMUSER_EW_CENTINEL_FLOW as Hidden in Property Manager so the EdgeWorker can read them.
Never attach the EdgeWorker to /centinel-validate
That rule carries the validator subrequest. If your bundle.json sets invoke-for-edgeworker-clients to true, turn the EdgeWorkers behavior off on that rule too.
Activations take 15 to 30 minutes
Property Manager changes propagate slowly across the network. Activate on staging first and run the checks there before production.
What stays untouched
- Your property origins, cacheability and purge rules
- Your Akamai App & API Protector and DDoS layers
- Your existing EdgeWorker logic, through flexible composition
- Your origin servers and application authentication
Akamai integration questions
Walk through your Akamai setup
Bring one route bots are hitting. We will map the right connector, timeouts, and log-only rollout for your Akamai stack.