-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
[v2] pathPrefix ignored in build from simple starter project #7898
Comments
Hi @mmsinclair, after updating the following packages, the redirection issue was not reproducible:
However, I faced another issue there after the updates. Prefetching of resources is failing because there is an extra
Environment info:
@pieh any inputs on this? |
Original issue was fixed in The follow up issue (one that @kakadiadarpan mention) I think was introduced by #7877 and this https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/cache-dir/prefetch.js#L48 particular line seems to be adding that extra path prefix to the path. |
Hi @kakadiadarpan and @pieh, thanks for the quick response. Will try out I haven't added |
You probably will have problem @kakadiadarpan reported when updating to |
Hi @pieh, commenting out that line fixes the problem. |
Same as @kakadiadarpan for me @pieh - no redirects to the root after render with that commented out |
@mmsinclair the redirection issue was fixed when you update your packages Commenting out that line |
Description
When
pathPrefix
is set to/foo
and the site is built and served statically, the browser renders the page and then immediately redirects to/
.I think it was probably caused by:
#7758
#7454 (comment)
Similar issues that might be related are:
#7107
#7289
#7642
I didn't see this happening until I upgraded gatsby and babel. This lock file entry seems to be the problem:
Downgrading to
2.0.0-rc.0
appears to fix the issue.Steps to reproduce
I've made an example project here: https://github.com/mmsinclair/gatsby-site-router-bug
Repro steps are:
pathPrefix
togatsby-config.js
public
toprod-build/foo
npx serve prod-build
http://localhost:5000/foo
orhttp://localhost:5000/foo/page-2
and both get redirected tohttp://localhost:5000
Expected result
It should navigate to
http://localhost:5000/foo
orhttp://localhost:5000/foo/page-2
.Actual result
It renders (see
curl
output) and it redirects tohttp://localhost:5000/
.Environment
The text was updated successfully, but these errors were encountered: