Skip to content

fix(seo): order header rules so asset CORP survives the catch-all - #4

Merged
imgul merged 1 commit into
mainfrom
arena/e1235655-env-compare
Oct 20, 2026
Merged

imgul merged 1 commit into
mainfrom
arena/e1235655-env-compare

Conversation

@imgul

@imgul imgul commented Oct 20, 2026

Copy link
Copy Markdown
Member

Follow-up to #3, found by checking the deployed headers instead of trusting the diff.

Vercel merges every matching header rule, and for a repeated key the last value wins. The catch-all /(.*) rule came last in the array, so its Cross-Origin-Resource-Policy: same-origin overwrote the cross-origin I added to /og-image.png, /favicon.ico and the other assets. The deploy went green and the card was still blocked.

Fix: the catch-all now comes first, assets after it. Documents keep same-origin; assets win with cross-origin.

The test asserts both the value and the ordering, because ordering is the part that silently broke it:

expect(sources.indexOf('/(.*)')).toBeLessThan(sources.indexOf('/og-image.png'));

382 tests, typecheck, build and guard green.

Vercel merges every matching header rule and the last value for a repeated key
wins. The catch-all came last, so its Cross-Origin-Resource-Policy: same-origin
overwrote the cross-origin one on /og-image.png and the icons — the card stayed
blocked after the first fix. The catch-all now comes first.

The test asserts both the value and the ordering, because the ordering is the
part that silently broke it.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
@imgul
imgul merged commit 4728ea8 into main Oct 20, 2026
1 check failed
imgul added a commit that referenced this pull request Oct 20, 2026
fix(seo): order header rules so asset CORP survives the catch-all
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