Skip to content

fix: allow reroute to point to prerendered route - #13575

Merged
dummdidumm merged 2 commits into
mainfrom
reroute-prerendered
Mar 12, 2025
Merged

dummdidumm merged 2 commits into
mainfrom
reroute-prerendered

Conversation

@dummdidumm

Copy link
Copy Markdown
Member

When rerouting to a path that is a prerendered page, the runtime would previously return a 404, because said path does not point to a route in the manifest. This adds a check for this specifically to do a fetch to the prerendered page in that case.


Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

When rerouting to a path that is a prerendered page, the runtime would previously return a 404, because said path does not point to a route in the manifest. This adds a check for this specifically to do a fetch to the prerendered page in that case.
@changeset-bot

changeset-bot Bot commented Mar 12, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5c95668

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/kit Patch

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

@dummdidumm
dummdidumm merged commit 68599e9 into main Mar 12, 2025
@dummdidumm
dummdidumm deleted the reroute-prerendered branch March 12, 2025 23:22
@github-actions github-actions Bot mentioned this pull request Mar 12, 2025
Copilot AI pushed a commit to Stadly/kit that referenced this pull request Mar 6, 2026
When rerouting to a path that is a prerendered page, the runtime would previously return a 404, because said path does not point to a route in the manifest. This adds a check for this specifically to do a fetch to the prerendered page in that case.
Rich-Harris pushed a commit that referenced this pull request Jul 29, 2026
…server fetch (#16525)

`has_prerendered_path` expects a base-inclusive pathname (its JSDoc says
so, and the `respond` call site passes one), but the `fetch` call site
prepends `base` to a pathname that already contains it, so the
prerendered bail-out never matches when `paths.base` is set. #13575
extracted the helper out of this check and added a second caller in
`respond.js`, prefixing `base` here in the same hunk; before that,
`fetch` checked `prerendered_routes.has(decoded)` directly. With the
bail-out firing, base-path apps also stop forwarding cookies and auth
headers on these sub-requests, matching what apps without a base already
do.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants