Skip to content

Commit a6c2fec

Browse files
committed
shorten asset routing summary
1 parent dbd0184 commit a6c2fec

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/content/partials/workers/workers-assets-routing-summary.mdx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@
22
{}
33
---
44

5-
When using Workers Assets, Cloudflare will first attempt to serve any static assets which match the incoming request.
5+
By default, Cloudflare first tries to serve a static asset, and failing that, invokes a Worker if one is present. If there is no Worker, or the Worker uses the asset binding (e.g. `env.ASSETS.fetch(request)`), then Cloudflare will fallback to the behaviour set by [`not_found_handling`](/workers/static-assets/routing/#not_found_handling).
66

7-
For example, if you have requests for `/logo.png` and `/blog/hello-world.html` in your assets directory, and make requests for `/logo.png` and `/blog/hello-world`, those files will be served respectively. The [`html_handling`](/workers/static-assets/routing/#html_handling) option allows you to customize the serving of HTML files if you have specific needs around redirects and trailing slashes.
8-
9-
If a request does not match a static asset, Cloudflare will then invoke your Worker script module, if one is present. This can be configured with the [`main`](/workers/wrangler/configuration/#inheritable-keys) property in the [Wrangler configuration file](/workers/wrangler/configuration/).
10-
11-
Finally, if a request does not match any static assets, and either a Worker script module is not present, or from within that Worker script module, the [asset binding](/workers/static-assets/binding/)'s `fetch` method is called (e.g. `env.ASSETS.fetch(request)`), Cloudflare will fall back to evaluating the [`not_found_handling`](/workers/static-assets/routing/#not_found_handling) behavior. By default, it will serve a null-body 404-status response, but this can be configured to instead serve custom HTML 404 pages, or to serve a single-page application (SPA).
12-
13-
At present, there is no way to customize this routing behavior beyond the `html_handling` and `not_found_handling` options. We plan to offer additional configuration controls, such as allowing you to always run the Worker script modules for certain paths, in the future.
7+
Refer to the [routing documentation](/workers/static-assets/routing/#routing-configuration) for more information on how to routing works with Workers Assets, and how to customize this behavior.

0 commit comments

Comments
 (0)