Skip to content

Middleware rewrites for dynamic routes not setting query/params in router #2750

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

Open
pieh opened this issue Jan 28, 2025 · 1 comment
Open
Labels
Next.js e2e test failure Errors identified through the Next.js repo e2e tests

Comments

@pieh
Copy link
Contributor

pieh commented Jan 28, 2025

This needs further investigation to diagnose the cause of the problem, but seems like there is some weird interaction when both middleware rewrite and next.config.js rewrite are used where Next's client router is not setting router.query to match expected dynamic segments

Data

The following is parsed automatically by the Next.js repo e2e test report generator.

test: Middleware Rewrite should handle catch-all rewrite correctly, Middleware Rewrite should handle static rewrite from next.config.js correctly, Middleware Rewrite should opt out of prefetch caching for dynamic routes
reason: Middleware rewrites for dynamic routes not setting query/params in router

@pieh pieh added the Next.js e2e test failure Errors identified through the Next.js repo e2e tests label Jan 28, 2025
@tigrr
Copy link

tigrr commented Feb 3, 2025

I don't have any rewrites in next.config.js but I still have the problem of missing query params in the page component after request being rewritten with NextResponse.rewrite in middleware. Works on local.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Next.js e2e test failure Errors identified through the Next.js repo e2e tests
Projects
None yet
Development

No branches or pull requests

2 participants