Redirect rules are firing before workers, right?

Hi there, Can I safely remove "html_handling": "force-trailing-slash" from a wrangler.jsonc if I configured redirect rule that forces trailing slashes? My redirect rule:
(not ends_with(http.request.uri.path, "/") and
http.request.uri.path ne "/" and
not http.request.uri.path contains "." and
not starts_with(http.request.uri.path, "/api/") and
not starts_with(http.request.uri.path, "/cdn-cgi/") and
not starts_with(http.request.uri.path, "/_astro/") and
not starts_with(http.request.uri.path, "/_actions/") and
not starts_with(http.request.uri.path, "/_server-islands/") and
not starts_with(http.request.uri.path, "/_image/"))
(not ends_with(http.request.uri.path, "/") and
http.request.uri.path ne "/" and
not http.request.uri.path contains "." and
not starts_with(http.request.uri.path, "/api/") and
not starts_with(http.request.uri.path, "/cdn-cgi/") and
not starts_with(http.request.uri.path, "/_astro/") and
not starts_with(http.request.uri.path, "/_actions/") and
not starts_with(http.request.uri.path, "/_server-islands/") and
not starts_with(http.request.uri.path, "/_image/"))
Then dynamic redirect to concat(http.request.uri.path, "/") with 301 status code
2 Replies
Rhaegal
Rhaegal4mo ago
I can tell you that Redirect Rules do run before Workers. (In the dashboard while on the page Rules -> Overview there's a button called "Traffic sequence showing how a request travels through the Cloudflare network) As for the rule you posted itself I can't say if it's safe to remove the field from the wrangler file.
TWEL
TWELOP4mo ago
Thank you very much✨ Seems like it is working as intended without wrangler’s param.

Did you find this page helpful?