Skip to content
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

Rewritten querystring not visible in getServerSideProps req object #40528

Closed
1 task done
colinclerk opened this issue Sep 13, 2022 · 2 comments
Closed
1 task done

Rewritten querystring not visible in getServerSideProps req object #40528

colinclerk opened this issue Sep 13, 2022 · 2 comments
Labels
bug Issue was opened via the bug report template.

Comments

@colinclerk
Copy link
Contributor

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

npx --no-install next info

Operating System:
  Platform: darwin
  Arch: x64
  Version: Darwin Kernel Version 21.6.0: Mon Aug 22 20:17:10 PDT 2022; root:xnu-8020.140.49~2/RELEASE_X86_64
Binaries:
  Node: 16.13.1
  npm: 8.19.1
  Yarn: 1.22.17
  pnpm: N/A
Relevant packages:
  next: 12.3.1-canary.1
  eslint-config-next: 12.3.0
  react: 18.2.0
  react-dom: 18.2.0

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

next dev

Describe the Bug

When a query string is added in middleware.js, it is not reflected in context.req.url of getServerSideProps.

Interestingly, the updated query string is reflected in context.query

This is similar to #40260 which was fixed in 12.3

Expected Behavior

context.req.url should contain the rewritten URL, not the original URL.

Link to reproduction

https://replit.com/@ColinSidoti/Nextjs

To Reproduce

Visit https://nextjs.colinsidoti.repl.co/

You should see:
Screen Shot 2022-09-14 at 12 11 36 AM

req.url should be "/?bar=baz" instead of "/"

@colinclerk colinclerk added the bug Issue was opened via the bug report template. label Sep 13, 2022
@colinclerk
Copy link
Contributor Author

We've since discovered that inconsistencies apply to the whole URL, not just the query string. I am therefore closing this in favor of the complete issue: #40651

@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

No branches or pull requests

1 participant