Skip to content

Middleware data redirects should normalize destination #1800

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ascorbic opened this issue Nov 22, 2022 · 1 comment · Fixed by #1928
Closed

Middleware data redirects should normalize destination #1800

ascorbic opened this issue Nov 22, 2022 · 1 comment · Fixed by #1928
Assignees

Comments

@ascorbic
Copy link
Contributor

In middleware we intercept redirects inside data requests (i.e. those in /_next/data/..) and set the x-next-redirect header instead. This is because the router handles the redirect instead. However we're currently not normalizing the redirect target. The correct behaviour should be to always set it to the normalized path, even if the target is for the data URL. e.g. a redirect to /_next/data/build-id/en-gb/hello.json?foo=bar should be normalized to /en-gb/hello?foo=bar. Next.js implements this here

e2e test: middleware-redirects

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants