Skip to content

Conversation

@FrankFMY
Copy link
Contributor

@FrankFMY FrankFMY commented Feb 5, 2026

When the ORIGIN environment variable is set without a protocol (e.g. ORIGIN=localhost:3000), the server responds with a generic 400 Bad Request error at request time, which is misleading since the HTTP request itself is not malformed.

This adds early validation at startup to check that ORIGIN includes a protocol scheme (http:// or https://), similar to how BODY_SIZE_LIMIT is validated. The error message now clearly explains what's wrong and how to fix it.

Closes #14978

Add early validation for the ORIGIN environment variable to check that
it includes a protocol (http:// or https://). Previously, setting ORIGIN
without a protocol (e.g. "localhost:3000") would cause a cryptic 400 Bad
Request error at request time. Now it fails fast at startup with a
descriptive error message.

Closes sveltejs#14978
@changeset-bot
Copy link

changeset-bot bot commented Feb 5, 2026

🦋 Changeset detected

Latest commit: 2565429

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-node 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

@FrankFMY
Copy link
Contributor Author

FrankFMY commented Feb 5, 2026

The CI failure is the write_types/index.spec.js > Creates correct $types test timing out on macOS webkit — this is a known flaky test unrelated to this change. Also added a changeset.

@elliott-with-the-longest-name-on-github
Copy link
Contributor

Closing in favor of #15045

@elliott-with-the-longest-name-on-github
Copy link
Contributor

Please perform at least a cursory check to make sure there are not other open PRs fixing the same issue you're filing a PR for. This is a useless waste of time for us to review and it's obvious there's another open PR attached to the associated issue.

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.

[adapter-node] - Use wrong ORIGIN value cause 400 Bad Request

2 participants