Skip to content

fix(web): answer preflights and encoded paths for moved static assets - #8135

Merged
ComputelessComputer merged 1 commit into
mainfrom
fix/moved-asset-redirect-edge-cases
Oct 21, 2026
Merged

ComputelessComputer merged 1 commit into
mainfrom
fix/moved-asset-redirect-edge-cases

Conversation

@ComputelessComputer

@ComputelessComputer ComputelessComputer commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Intent: follow-up to #8134 review. The static.anarlog.so redirect for moved screenshots answered CORS preflights with a 301, which browsers won't follow. It also missed percent-encoded spellings of an old path (e.g. free%2D11.webp), which servePublicAsset decodes. Only GET/HEAD now redirect, so preflights still get a 204, and the path is decoded before the lookup.

Demo

N/A: edge cases of the Worker redirect, covered by tests.

Verification

  • node --test src/cloudflare/static-assets.test.ts (encoded path → 301, OPTIONS → 204)
  • pnpm -F @anlg/web typecheck, pnpm -F @anlg/web test (378 pass)
  • dprint check

Summary by cubic

Fixes two edge cases in the moved static asset redirect: browsers refuse to follow a 301 on a CORS preflight, and percent-encoded spellings of old paths were previously missed.

  • Only GET/HEAD requests now redirect, so OPTIONS preflights keep getting a 204 response.
  • The path is percent-decoded before the moved-asset lookup, matching how servePublicAsset reads paths.

Written for commit dd68b1a. Summary will update on new commits.

View guided diff Turn on auto-fix

The moved-asset redirect answered OPTIONS with a 301, which browsers refuse to follow for a preflight, and missed percent-encoded spellings of an old path that servePublicAsset used to decode. Redirect only GET/HEAD so preflights get their 204, and decode the path before the lookup.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@ComputelessComputer
ComputelessComputer merged commit 52a9586 into main Oct 21, 2026
10 checks passed
@ComputelessComputer
ComputelessComputer deleted the fix/moved-asset-redirect-edge-cases branch October 21, 2026 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant