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
HEAD prefetch requests caused by middleware do not respect basePath #31013
Labels
Comments
10 tasks
kodiakhq bot
pushed a commit
that referenced
this issue
Nov 9, 2021
Fixes #31013 My understanding is that there are currently two functions `Router.change` and `Router.prefetch` leading to `Router._preflightRequest` and they pass `options.as` URL differently regarding base path. In this PR, such difference will be handled in `Router._preflightRequest` to add base path before actually fetching. Thanks for the review! P.S. Since middleware feature is a relatively new, official maintainers might not want external contributions around this area at this stage. I totally understand such situation, so please let me know if that's the case. I can look for other issues to investigate instead. ## Bug - [x] Related issues linked using `fixes #number` - [x] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes by running `yarn lint`
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
natew
pushed a commit
to natew/next.js
that referenced
this issue
Feb 16, 2022
Fixes vercel#31013 My understanding is that there are currently two functions `Router.change` and `Router.prefetch` leading to `Router._preflightRequest` and they pass `options.as` URL differently regarding base path. In this PR, such difference will be handled in `Router._preflightRequest` to add base path before actually fetching. Thanks for the review! P.S. Since middleware feature is a relatively new, official maintainers might not want external contributions around this area at this stage. I totally understand such situation, so please let me know if that's the case. I can look for other issues to investigate instead. ## Bug - [x] Related issues linked using `fixes #number` - [x] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes by running `yarn lint`
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
What version of Next.js are you using?
12.0.2
What version of Node.js are you using?
14
What browser are you using?
Chrome
What operating system are you using?
macOs
How are you deploying your application?
next start
Describe the Bug
When having a basePath in next-config and some middleware then next.js fires HEAD request for link prefetching.
These HEAD request do not respect basePath.
Expected Behavior
HEAD request respects basePath.
To Reproduce
repository to reproduce:
https://github.com/alfrescian/next-middleware-base-path-issue
next-config:
module.exports = { basePath: "/my-base" };
You'll notice HEAD request go to http://localhost:3000/blend9709 instead of expected http://localhost:3000/my-base/blend9709
The text was updated successfully, but these errors were encountered: