Skip to content

Commit bcae885

Browse files
committed
Update routing behavior section
1 parent cf69948 commit bcae885

File tree

1 file changed

+4
-5
lines changed
  • src/content/docs/workers/static-assets

1 file changed

+4
-5
lines changed

src/content/docs/workers/static-assets/index.mdx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,12 @@ export default {
8383

8484
### Routing behavior
8585

86-
By default, if a requested URL matches a file in the static assets directory, that file will always be served — without running Worker code. If no matching asset is found and a Worker is configured, the request will be processed by the Worker instead.
86+
By default, if a requested URL matches a file in the static assets directory, that file will always be served — without running Worker code. If no matching asset is found and a Worker is configured, the request will be processed by the Worker instead. The Worker can choose to pass the request to the asset binding (through `env.ASSETS.fetch()`). If no worker is set up, a `404 Not Found` response is returned.
8787

88-
- If no Worker is set up, the [`not_found_handling`](/workers/static-assets/#routing-behavior) setting in your Wrangler configuration determines what happens next. By default, a `404 Not Found` response is returned.
88+
The default behavior when neither an asset nor a Worker is found can be changed by setting the [`not_found_handling` option under `assets`](/workers/wrangler/configuration/#assets) in your Wrangler configuration:
8989

90-
- If a Worker is configured and a request does not match a static asset, the Worker will handle the request. The Worker can choose to pass the request to the asset binding (through `env.ASSETS.fetch()`), following the `not_found_handling` rules.
91-
92-
You can configure and override this default routing behaviour. For example, if you have a Single Page Application and want to serve `index.html` for all unmatched routes, you can set `not_found_handling = "single-page-application"`:
90+
- `not_found_handling = "single-page-application"`: Sets your application to return `index.html` for unmatched routes. Use this if you have a Single Page Application.
91+
- `not_found_handling = "404-page""`: Sets your application to return `404.html` for unmatched routes.
9392

9493
<WranglerConfig>
9594

0 commit comments

Comments
 (0)