fix(server): respect custom dev ports in origin allowlist and admin p…#200
Open
dremchee wants to merge 2 commits into
Open
fix(server): respect custom dev ports in origin allowlist and admin p…#200dremchee wants to merge 2 commits into
dremchee wants to merge 2 commits into
Conversation
…laceholder A custom VITE_PORT broke every state-changing request in dev: the CSRF origin check only allowlisted the default Vite ports 5173/5174, so the browser's Origin on any other port got 403 'Forbidden: invalid origin' — including the first-run setup POST, making the install wizard unusable. - Derive DEV_ORIGIN_ALLOWLIST from the environment via a pure buildDevOriginAllowlist(env): default ports plus VITE_PORT, each as localhost and 127.0.0.1, plus the existing VITE_ALLOWED_ORIGIN escape hatch for non-localhost dev hosts. - Extract DEFAULT_CMS_PORT / DEFAULT_VITE_PORT into server/config.ts as the single source of truth; consume them in the router, security, healthcheck, vite.config.ts, and the dev/start scripts instead of scattered '3001' / '5173' literals. - Point the 'Admin UI not served on this port' placeholder page at the configured PORT / VITE_PORT instead of hardcoded 3001 / 5173. - Document VITE_PORT and VITE_ALLOWED_ORIGIN in .env.example and update the auth-and-access doc, which had drifted from the code.
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.
A custom VITE_PORT broke every state-changing request in dev: the CSRF origin check only allowlisted the default Vite ports 5173/5174, so the browser's Origin on any other port got 403 'Forbidden: invalid origin' — including the first-run setup POST, making the install wizard unusable.
Summary
Describe the change and why it is needed.
Verification
bun run buildbun testbun run lintChecklist