2026-11-29
Create and call
export default { async fetch(request, env) { return new Response('hello from an edge worker\n'); } };- Open Edge Workers, or call create_edge_worker with a name, an ES module that has a default export, a compatibility date and a domain.
- The worker runs at once within the token's policy. Its routes are https://your-domain/_edge/name and https://your-domain/edge/name.
- Check it: curl -sS https://your-domain/_edge/name returns the text the worker returns.
Update and detach
- update_edge_worker changes the code and applies at once.
- update_edge_worker with domain set to null detaches the worker. Its route stops, and the domain's own homepage returns.
- delete_edge_worker waits for a person in Approvals. Nothing is removed until the owner approves.
Warning
A worker attached to a domain takes over that domain's homepage over HTTPS, so the static index.html stops showing there until the worker is detached. For tests, attach a worker to a subdomain that you do not use for anything else.
