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

fix(gatsby): use pathPrefix for SSR/DSG page-data requests with gatsby serve #36231

Merged
merged 3 commits into from
Jul 26, 2022

Conversation

pieh
Copy link
Contributor

@pieh pieh commented Jul 25, 2022

Description

Start with failing test and SSR page to path-prefix e2e tests and couple of assertions, will be followed by a fix to make it green

Related Issues

Fixes #35406

@pieh pieh added the topic: render-mode Related to Gatsby's different rendering modes label Jul 25, 2022
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Jul 25, 2022
@pieh pieh removed the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Jul 25, 2022
@pieh pieh force-pushed the fix/engines/path-prefix-serve branch from e134160 to 01a61c9 Compare July 25, 2022 13:22
handler(request, response, {
public: path.resolve(`assets`),
headers: [
{
source: `**/*`,
headers: [
{
key: `Access-Control-Allow-Origin`,
value: `*`,
},
],
},
],
})
proxy.web(request, response, { target: "http://localhost:9000" })
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

used proxy here instead of separate serve because of "on-demand" behaviour of DSG/SSR which would need to be either replicated here (or just forward request to serve to let it handle it)

app.get(
router.get(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actual fix - router strips path prefix and enables engines to find proper pages

@tyhopp tyhopp merged commit 3dee0f6 into master Jul 26, 2022
@tyhopp tyhopp deleted the fix/engines/path-prefix-serve branch July 26, 2022 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: render-mode Related to Gatsby's different rendering modes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pathPrefix and SSR@runtime does not work together
2 participants