cloudflare · Cloudflare Workers Docs
Static Assets Worker script
Configures the execution order between Cloudflare Worker scripts and static asset serving using the assets.run_worker_first setting to implement middleware or selective routing.
Derived skill
Files assembled from official documentation
Viewing SKILL.md
Static Assets Worker script
Configures the execution order between Cloudflare Worker scripts and static asset serving using the assets.run_worker_first setting to implement middleware or selective routing.
When To Use
Use when you need to run a Worker script before serving static assets for tasks like authentication, request logging, or HTML transformation, or when you need to apply Worker-first routing to specific URL patterns.
Reference Files
| File | Contains | Use For |
|---|---|---|
SKILL.md | Entry point: scope, routing table, and workflow. | Start here. |
docs/workers-static-assets-routing-worker-script-workflow-guide.md | Documentation explaining how to configure and run a Worker script to intercept or complement requests when using Cloudflare Workers Static Assets. | Questions about documentation explaining how to configure and run a Worker script to intercept or complement requests when using Clou... |
examples/workers-static-assets-routing-worker-script-cloudflare-workers-static-as.text | A wrangler.toml configuration file demonstrating how to bind static assets to a Cloudflare Worker with the runworkerfirst option enabled. | Exact payloads, commands, or snippets shown in A wrangler.toml configuration file demonstrating how to bind static assets to a Cloudflare Worker with the runworkerf... |
examples/workers-static-assets-routing-worker-script-cloudflare-workers-static-as-2.text | A wrangler.toml configuration file defining the compatibility date, main entry point, and static assets binding for a Cloudflare Workers project. | Exact payloads, commands, or snippets shown in A wrangler.toml configuration file defining the compatibility date, main entry point, and static assets binding for a... |
examples/workers-static-assets-routing-worker-script-cloudflare-workers-static-as-3.text | A JavaScript worker script using WorkerEntrypoint to implement custom authentication logic before routing requests to static assets. | Exact payloads, commands, or snippets shown in A JavaScript worker script using WorkerEntrypoint to implement custom authentication logic before routing requests to... |
examples/workers-static-assets-routing-worker-script-cloudflare-workers-static-as-4.text | A TypeScript worker script using WorkerEntrypoint to implement custom authentication logic before routing requests to static assets. | Exact payloads, commands, or snippets shown in A TypeScript worker script using WorkerEntrypoint to implement custom authentication logic before routing requests to... |
examples/workers-static-assets-routing-worker-script-cloudflare-workers-static-as-5.text | A wrangler.toml configuration file demonstrating how to bind static assets and configure single-page application routing for a Cloudflare Worker. | Exact payloads, commands, or snippets shown in A wrangler.toml configuration file demonstrating how to bind static assets and configure single-page application rout... |
examples/workers-static-assets-routing-worker-script-cloudflare-workers-static-as-6.text | A wrangler.toml configuration file demonstrating how to set up a worker with static assets, SPA notfound handling, and specific route execution rules. | Exact payloads, commands, or snippets shown in A wrangler.toml configuration file demonstrating how to set up a worker with static assets, SPA notfound handling, an... |
examples/workers-static-assets-routing-worker-script-cloudflare-workers-static-as-7.text | A JavaScript Worker script using WorkerEntrypoint to handle OAuth callbacks while routing other requests to static assets. | Exact payloads, commands, or snippets shown in A JavaScript Worker script using WorkerEntrypoint to handle OAuth callbacks while routing other requests to static as... |
examples/workers-static-assets-routing-worker-script-cloudflare-workers-static-as-8.text | A TypeScript Worker script using WorkerEntrypoint to handle OAuth callbacks while routing other requests to static assets. | Exact payloads, commands, or snippets shown in A TypeScript Worker script using WorkerEntrypoint to handle OAuth callbacks while routing other requests to static as... |
What This Skill Covers
- If you have both static assets and a Worker script configured, Cloudflare will first attempt to serve static assets if one matches the incoming request. You...
- Main sections:
Run your Worker script first,Run Worker before each request,Run Worker first for selective paths.
Workflow
- Open the most relevant file under
docs/for the exact documented workflow and wording. - Open
schemas/files for exact structured contracts. - Open
examples/files for concrete requests, commands, snippets, and manifests. - Do not add behavior or configuration that is not present in the attached source files.
Canonical source: https://developers.cloudflare.com/workers/static-assets/routing/worker-script
