Skip to content

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

Draft
teemingc wants to merge 3 commits into
teemingc-vercel-isr-trailing-slash-testfrom
teemingc-fix-vercel-normalization-redirects
Draft

fix(adapter-vercel): make normalization redirects root-relative#16905
teemingc wants to merge 3 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 0ab02ec:

pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/0ab02ecf614e3c7cb5ba94e95d66cf946e4ab9c0

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

🦋 Changeset detected

Latest commit: 0ab02ec

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

This PR includes changesets to release 1 package
Name Type
@sveltejs/adapter-vercel 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

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

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