Dev.to WebDev 🛠 Dev 👁 0 📖 2 min read

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 site

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 against the live hosts still looked like this (no follow, HTTPS only):

A request to /wissen without the slash came back 307, Location /wissen/. The same happened for /tools to /tools/. On the second site, /tools was 307 to /tools/, and /about/ was 307 to /about.

The cause sits in the generated wrangler config: assets.html_handling is set to auto-trailing-slash. Cloudflare's own docs for html-handling say that every html_handling mode issues these redirects as 307. There is no documented switch for the status code. The platform enforces 307 here.

That is inconvenient for SEO. 307 means "temporary". Search engines can keep the typo URL in the index for longer than you want. For a slash rule that will not change, 301 is the better signal.

Cloudflare _redirects does support 301. The documented limit is 2,000 static rules. The smallest fix we tried was to append fixed 301 rules at build time: folder pages from /x to /x/, file pages from /x/ to /x/, and only when that exact path had no rule yet. Exact-path sources should not loop, because each rule points at the other form, and the canonical form itself stays on 200.

I could not test this on production. GitHub Actions was blocked by a billing limit, so nothing was deployed. Locally, wrangler 4.165.0 in dev --local answered 301 on every new rule, and the target then returned 200: 102 of 102 paths on one site, 80 of 80 on the other. Two extra hits on the second site belonged to an existing /tiktok rule, not a new failure.

The leftover risk is real: miniflare can disagree with production. Until a production curl shows 301 on those typo URLs, the live sites still answer 307. If production ever misbehaves, the change is one commit and can be reverted.

I would not rewrite internal links for this. They were already clean. The 307s only fire when a slash is typed the wrong way.

Safak Tepecik

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.