references/static-assets/api.md
Static Assets Binding API
Read the binding reference before implementing calls. Check the configured binding name and use the project's existing environment types.
| Task | Documentation | |------|---------------| | Forward a request or fetch a specific asset | Runtime API reference | | Understand how binding requests apply HTML and fallback settings | Binding fetch behavior and HTML handling | | Run authorization or transform content before serving | Run your Worker script first | | Inspect default MIME, cache, and validation headers | Default headers | | Add or override response headers | Custom headers and Worker-response caveat | | Fetch assets imported by Vite | Vite asset features |
When selecting a different asset, construct a full URL using the incoming request as the base. Preserve the returned status and headers when transforming a response; do not collapse every unsuccessful response into an application 404.
See configuration.md for bindings and patterns.md for routing choices.