Closed
Description
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