Open
Conversation
Add ALLOWED_ORIGINS environment variable to allow multiple origins for CORS and CSRF protection. Implements a custom CSRF protection hook in hooks.server.ts that checks requests against the allowed origins. Updates documentation and disables SvelteKit's default CSRF origin check to support this custom logic.
Set 'host: true' in the Vite server configuration to allow access from other network addresses.
cmintey
reviewed
Feb 10, 2026
Owner
cmintey
left a comment
There was a problem hiding this comment.
I don't really understand why this change is needed? I don't love turning off the built in CSRF protection for a home baked one
| }) | ||
| ], | ||
| server: { | ||
| host: true, |
Owner
There was a problem hiding this comment.
This is not needed. You can run the dev server with the --host option
Author
|
I wanted to be able to access thru my reverse proxy but also locally. By the way, when you fail the configuration of the url, if you start the account configuration, then after that you have to delete all the data, you wont be able to register again even if you modify the url. |
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds multiple allowed origins for CSRF protection, making it possible to access the application from several URLs (such as a domain name and a local IP address).
It achieves this by adding a new
ALLOWED_ORIGINSenvironment variable, implementing custom CSRF verification logic that checks requests against this list (it also includes updated documentation and configuration accordingly).CSRF Protection & Allowed Origins:
ALLOWED_ORIGINSenvironment variable, and implemented helper functions (isAllowedOrigin,getAllowedOrigins) to parse and validate origins insrc/lib/server/auth.ts.csrfProtection) insrc/hooks.server.tsthat checks incoming requests' origins against the allowed list, and combined it with the main handler usingsequence.svelte.config.jsto avoid conflicts with the new custom implementation.Documentation & Configuration:
.env.exampleandREADME.mdto document the newALLOWED_ORIGINSvariable and provide usage examples.host: true) invite.config.ts, making local network access easier for development and testing.