Skip to content

fix: preserve paths.base when vite preview redirects a prerendered page to the correct trailing slash - #16836

Merged
Rich-Harris merged 2 commits into
version-3from
fix-preview-base-redirect
Aug 18, 2026
Merged

fix: preserve paths.base when vite preview redirects a prerendered page to the correct trailing slash#16836
Rich-Harris merged 2 commits into
version-3from
fix-preview-base-redirect

Conversation

@Nic-Polumeyv

Copy link
Copy Markdown
Contributor

The trailing-slash redirect for prerendered pages in exports/vite/preview/index.js writes an absolute location from the pathname the middleware sees, but that middleware runs inside scoped(base, ...), which has already stripped paths.base. With a base path the browser lands on /nested/ instead of /base/nested/. Production (#9351) and adapter-node (#16431) send a relative location for this reason and use 308; preview now does the same via relative_pathname.

@pkg-svelte-dev

pkg-svelte-dev Bot commented Aug 17, 2026

Copy link
Copy Markdown

Install the latest version of @sveltejs/kit from 9764887:

pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/9764887370a7f7d35cdea1325435557c92d01615

Open in pkg.svelte.dev: https://pkg.svelte.dev/repos/kit/pr/16836

@changeset-bot

changeset-bot Bot commented Aug 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9764887

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

@svelte-docs-bot

Copy link
Copy Markdown

@Rich-Harris
Rich-Harris merged commit 9a910f3 into version-3 Aug 18, 2026
27 checks passed
@Rich-Harris
Rich-Harris deleted the fix-preview-base-redirect branch August 18, 2026 14:29
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