You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
WC-3583 Update static routing for run_worker_first based configuration
Now that we're not providing this configuration via _routes.json, we can
relax some of the configuration. Much of this happens on the backend,
but some field names have been changed ("include" -> "user_worker",
"exclude"->"asset")
Copy file name to clipboardExpand all lines: .changeset/tasty-hoops-own.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,10 +2,10 @@
2
2
"@cloudflare/workers-shared": minor
3
3
---
4
4
5
-
Adds support for static routing (i.e. \_routes.json) to Workers Assets
5
+
Adds support for static routing to Workers Assets
6
6
7
7
Implements the proposal noted here https://github.com/cloudflare/workers-sdk/discussions/9143
8
8
9
-
In brief: when static routing is present for a Worker with assets, routing via those static rules takes precedence. When a request is evaluated in the Router Worker, the request path is first compared to the "exclude" rules. If any match, the request is forwarded directly to the Asset Worker. If instead any "include" rules match, the request is forwarded directly to the User Worker. If neither match (or static routing was not provided), the existing behavior takes over.
9
+
In brief: when static routing is present for a Worker with assets, routing via those static rules takes precedence. When a request is evaluated in the Router Worker, the request path is first compared to the "asset" rules (which are to be specific via "negative" rules, e.g. "!/api/assets"). If any match, the request is forwarded directly to the Asset Worker. If instead any "user\_worker" rules match, the request is forwarded directly to the User Worker. If neither match (or static routing was not provided), the existing behavior takes over.
10
10
11
-
As part of this explicit routing, when static routing is present, the check against "Sec-Fetch-Mode: navigate" (to guess if this should serve an asset or go to the User Worker for not_found_handling) is disabled. Routing can be controlled by uploading a \_routes.json, and asset serving (including when an index.html or 404.html page is served) will be more simple.
11
+
As part of this explicit routing, when static routing is present, the check against "Sec-Fetch-Mode: navigate" (to guess if this should serve an asset or go to the User Worker for not\_found\_handling) is disabled. Routing can be controlled by setting routing rules via "run\_worker\_first", and asset serving (including when an index.html or 404.html page is served) will be more simple.
0 commit comments