Skip to content

breaking: forbid external redirects by default#16198

Open
dummdidumm wants to merge 3 commits into
version-3from
redirect-external
Open

breaking: forbid external redirects by default#16198
dummdidumm wants to merge 3 commits into
version-3from
redirect-external

Conversation

@dummdidumm

@dummdidumm dummdidumm commented Jun 29, 2026

Copy link
Copy Markdown
Member

You now have to pass { external: string[] | boolean } to redirect if you want to redirect to an external URL (or a javascript: URL).

Closes #15131

@changeset-bot

changeset-bot Bot commented Jun 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3b529bf

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 Major

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

Comment on lines +109 to +110
BROWSER +
(BROWSER ? window.location.href : try_get_request_store()?.event.request.url)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
BROWSER +
(BROWSER ? window.location.href : try_get_request_store()?.event.request.url)
` (redirect attempted from ${BROWSER ? window.location.href : try_get_request_store()?.event.request.url})`

The DEV error message for a forbidden external redirect concatenates the raw BROWSER boolean into the message string, producing a malformed message.

Fix on Vercel

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.

1 participant