Edge Workers
Run JavaScript on CDN edge nodes to respond directly or rewrite origin requests.
Edge Workers let you run JavaScript on CDN edge nodes to handle requests before they reach your origin: return a response directly, issue redirects, check tokens, or add headers to the request sent to your origin. Your code runs in an isolated sandbox on each edge node, with no servers for you to manage.
Workers are part of the CDN product. You create a Worker and write its code in the console, then bind it to specific paths of a CDN domain using a route pattern.
What you can do with Workers
- Return custom content for specific paths without contacting the origin
- Redirect based on path or request headers
- Perform simple access checks at the edge (for example, validating an
Authorizationheader) - Add or overwrite headers on the request forwarded to your origin (for example, an A/B bucket marker)
- Call public HTTP(S) APIs and build a response from the result
In this section
- Overview and quickstart: console pages, programming model, a minimal example, route binding rules and resource limits.
Note
Workers require a domain that is already onboarded to the CDN. The number of Worker routes you can bind per domain depends on your CDN plan.
這個頁面對你有幫助嗎?