-
Notifications
You must be signed in to change notification settings - Fork 86
fix: prepend basePath to static file URLs #1213
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
Conversation
✔️ Deploy Preview for netlify-plugin-nextjs-nx-monorepo-demo ready! 🔨 Explore the source changes: 5c30f23 🔍 Inspect the deploy log: https://app.netlify.com/sites/netlify-plugin-nextjs-nx-monorepo-demo/deploys/620a77f9295dab000812e4ed 😎 Browse the preview: https://deploy-preview-1213--netlify-plugin-nextjs-nx-monorepo-demo.netlify.app/ |
✔️ Deploy Preview for netlify-plugin-nextjs-export-demo ready! 🔨 Explore the source changes: 5c30f23 🔍 Inspect the deploy log: https://app.netlify.com/sites/netlify-plugin-nextjs-export-demo/deploys/620a77fa55e6020008336b8f 😎 Browse the preview: https://deploy-preview-1213--netlify-plugin-nextjs-export-demo.netlify.app |
✔️ Deploy Preview for netlify-plugin-nextjs-static-root-demo ready! 🔨 Explore the source changes: 5c30f23 🔍 Inspect the deploy log: https://app.netlify.com/sites/netlify-plugin-nextjs-static-root-demo/deploys/620a77fa93c5d90008cfbf26 😎 Browse the preview: https://deploy-preview-1213--netlify-plugin-nextjs-static-root-demo.netlify.app |
✔️ Deploy Preview for netlify-plugin-nextjs-demo ready! 🔨 Explore the source changes: 5c30f23 🔍 Inspect the deploy log: https://app.netlify.com/sites/netlify-plugin-nextjs-demo/deploys/620a77f996e11c000860fcf7 😎 Browse the preview: https://deploy-preview-1213--netlify-plugin-nextjs-demo.netlify.app |
Test summaryRun details
View run in Cypress Dashboard ➡️ This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
Test summaryRun details
View run in Cypress Dashboard ➡️ Failures
This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
Test summaryRun details
View run in Cypress Dashboard ➡️ This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
1a0a9dc
to
5d28a4d
Compare
41a252a
to
d6559d4
Compare
4c121a7
to
953a81d
Compare
Summary
This partially fixes a complex bug that could manifest in several ways. There is an additional internal bugfix that needs to land in the proxy before this can be finally fixed.
Some of the details of the issue:
/page.html
and that file has been moved to the CDN, it will try to loadhttps://example.com/page.html
. It finds this domain usingevent.rawUrl
.basePath
, so was loading the URL without the basePath. This was fine when loading the site directly, because the actual files were in that place too.rawUrl
passed to the proxied function is the original URL, rather than the proxied URL. There is no way for the function to know its own URL.https://originsite/basePath
tohttps://targetsite/basePath
, it would try to load the files fromoriginsite
instead oftargetsite
, and because the path didn't match the proxy pattern, it was failing to load, giving a 404This fix
This fix ensures that the files moved to the CDN are moved under the correct basePath, meaning that the file
docs.html
is moved tobasePath/docs.html
. The proxy bug is still in existence, but because the basePath matches, the CDN request will also be proxied.This PR also adds a test with with a basePath set. There aren't currently any cypress tests for it, but it can be manually tested. The proxy site is pointing at the deploy preview for this PR.
Test plan
Relevant links (GitHub issues, Notion docs, etc.) or a picture of cute animal
Fixes #965
Standard checks:
🧪 Once merged, make sure to update the version if needed and that it was published correctly.