Skip to content

fix(adapter-vercel): make normalization redirects root-relative - #16905

Closed
teemingc wants to merge 4 commits into
teemingc-vercel-isr-trailing-slash-testfrom
teemingc-fix-vercel-normalization-redirects
Closed

fix(adapter-vercel): make normalization redirects root-relative#16905
teemingc wants to merge 4 commits into
teemingc-vercel-isr-trailing-slash-testfrom
teemingc-fix-vercel-normalization-redirects

Conversation

@teemingc

@teemingc teemingc commented Aug 22, 2026

Copy link
Copy Markdown
Member

What this does

Converts SvelteKit normalization redirects to root-relative Location headers in the Vercel serverless wrapper. This prevents Vercel from resolving relative normalization redirects against its internal ISR rewrite URL.

Stacked on #16903, which adds the failing ISR + trailingSlash: 'always' test.


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

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

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:.

Edits

  • Please ensure that 'Allow edits from maintainers' is checked. PRs without this option may be closed.

@pkg-svelte-dev

pkg-svelte-dev Bot commented Aug 22, 2026

Copy link
Copy Markdown

Install the latest version of @sveltejs/kit from 82d7be7:

pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/82d7be77c6f3ba0268edac9c1b98cc54fab8e3e9

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

@changeset-bot

changeset-bot Bot commented Aug 22, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 82d7be7

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@teemingc
teemingc changed the base branch from version-3 to teemingc-vercel-isr-trailing-slash-test August 22, 2026 17:17
@teemingc
teemingc marked this pull request as draft August 22, 2026 17:18
@svelte-docs-bot

Copy link
Copy Markdown

@teemingc teemingc added needs-platform-tests This PR needs to run platform tests in order to merge. pkg:adapter-vercel Pertaining to the Vercel adapter labels Aug 22, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@teemingc
teemingc force-pushed the teemingc-fix-vercel-normalization-redirects branch from 85f1862 to 43672c5 Compare August 22, 2026 17:26
@teemingc
teemingc force-pushed the teemingc-fix-vercel-normalization-redirects branch 8 times, most recently from b9b2269 to 9b59b02 Compare August 22, 2026 18:46
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@teemingc
teemingc force-pushed the teemingc-fix-vercel-normalization-redirects branch from 9b59b02 to 0ab02ec Compare August 22, 2026 19:26
@Nic-Polumeyv

Copy link
Copy Markdown
Contributor

The problem is upstream of the location header: __pathname never contains the trailing slash, so kit thinks the visitor is at /isr-trailing-slash-absolute even when they requested /isr-trailing-slash-absolute/, and redirects them to where they already are. That loops no matter what the location header looks like. If the route's src captures the trailing slash and passes it through (__pathname=/isr-trailing-slash-absolute$1), kit sees the real path and doesn't redirect at all.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@teemingc teemingc closed this Aug 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-platform-tests This PR needs to run platform tests in order to merge. pkg:adapter-vercel Pertaining to the Vercel adapter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants