-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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: correctly map prerendered pages when base path is set #11245
Conversation
🦋 Changeset detectedLatest commit: 5fa55b6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
It looks like the same change might be needed in other adapters. We should update any affected at the same time, so they don't get out of sync with each other kit/packages/adapter-cloudflare/index.js Line 31 in ded1630
|
I’m not sure if it affects I still need to check the other adapters. |
I don't think the other adapters are affected because they serve the static files like other simple static hosting service (e.g., navigating to /base/about will always return the about.html file). It's only cloudflare workers that needs to be told specifically what pathname it needs to serve the correct file. As an aside, here are how vercel, netlify, and cloudflare handle multiple projects with the same domain but different base paths. |
This doesn't appear to be fixed. For example, if I set my base to /blog, and then upload to Cloudflare Pages, everything works except anything in the static folder. Everything in static folder is completely inaccessible. The structure of the contents in Cloudflare Pages appears to be correct, the files are there, they are under the subfolder blog, but when I attempt to navigate to them I get a 404. In addition, if I attempt to navigate to them using root, it goes into an infinite refresh loop. |
Just to clarify, are you using the cloudflare adapter or the cloudflare workers adapter? Can you provide a minimal reproduction in a new issue? |
Using the cloudflare adapter. Yes, I could probably get a reproduction working as all I really did was setup a new project with the Cloudflare Adapter, and set the base folder, added some images and a manifest file to static. That was basically it. I'll try to get it repro'd for you and I'll create a new issue. Oh and prerender was set to true. |
fixes #11210
Previously, the prerendered manifest didn't set the base path so it looked like this:
However, this is incorrect because it is stored in the KV with the key
/base/about.1asdf34.html
(ignore the hash, cloudflare handles it). This is also because we upload the build output such that the public files live in the base folder.cloudflare/public/base/about.html
.Therefore, the new manifest when a base path is set should look like this:
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpm changeset
and following the prompts. Changesets that add features should beminor
and those that fix bugs should bepatch
. Please prefix changeset messages withfeat:
,fix:
, orchore:
.