Skip to content

fix: csp headers for index pages#2593

Open
mburri wants to merge 2 commits into
mainfrom
fix/csp-headers-for-index-pages
Open

fix: csp headers for index pages#2593
mburri wants to merge 2 commits into
mainfrom
fix/csp-headers-for-index-pages

Conversation

@mburri

@mburri mburri commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

No CSP Header was set for index pages, e.g. https://visualize.admin.ch/en

Pages with more than one path segment included the correct headers: https://visualize.admin.ch/en/imprint

The cause was that the matcher in middleware.ts was is recompiled for i18n routing during the build. The newly generated matcher did only match routes with at least two path segments, e.g. /en/imprint, but not /en itself.

It is not known to me whether upgrading next.js would fix this too.


  • [ x ] I added a CHANGELOG entry
  • [ x ] I made a self-review of my own code

@mburri mburri requested a review from hupf July 1, 2026 07:53
@vercel

vercel Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
visualization-tool Ready Ready Preview, Comment Jul 1, 2026 7:53am

Request Review

@hupf hupf 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.

Looks good. As the Next.js + i18n combo is causing this behavior, it may be useful to check the header in an E2E test, to catch when the behavior changes again...

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.

2 participants