Cloudflare auto-trailing-slash still answers 307. _redirects can do 301.
I looked after two static sites on Cloudflare Workers Assets. Internal links already used the canonical form with or without a trailing slash, depending on whether the page is a directory or a file. A crawler of the sites found no internal links that hit a 3xx. The messy cases were typed URLs: someone leaves the slash off a folder page, or adds one to a file page. On 26 November 2026 a curl…
Cloudflare Workers Assets enabled two static sites to use internal links with or without a trailing slash, depending on whether the page is a directory or a file. A crawler found no internal links hitting a 3xx status code. However, when manually testing the live hosts, a request to a URL without a trailing slash, such as /wissen, returned a 307 status code, with the Location header pointing to the URL with a trailing slash (/wissen/). The same behavior was observed for other typo URLs, like /tools and /about.
The issue stems from the generated wrangler config, where assets.html_handling is set to auto-trailing-slash. Cloudflare's documentation states that every html_handling mode, including auto-trailing-slash, issues these redirects as 307 status codes. There is no documented switch to change the status code.
Using Cloudflare's _redirects feature, which supports 301 status codes, can resolve the problem. However, there is a documented limit of 2,000 static rules. To mitigate the risk of looping redirects, the solution involves appending fixed 301 rules at build time for folder pages and file pages. By ensuring an exact-path source for each rule, the canonical form remains on a 200 status code.
While testing locally using wrangler 4.165.0 in dev mode with --local, a 301 status code was returned for every new rule. On one site, 102 of 102 paths, and on the other site, 80 of 80 paths, followed this change. The second site had an additional hit from an existing /tiktok rule.
There is a residual risk that miniflare may not match the production environment. Until a production curl shows a 301 status code for the typo URLs, the live sites will continue to answer with a 307. If production ever misbehaves, the change can be reverted with a single commit. While the internal links were already clean, the 307 status codes only occur when a trailing slash is typed incorrectly.
Rewritten by urgent.news; may contain errors — check the original.
Source: dev.to