forked from 0xWheatyz/SPARC
Make CORS allowed origins configurable via environment variable #117
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
api.pyhardcodeslocalhost:3000andlocalhost:5173as the only permitted CORS origins. This prevents the frontend from working when deployed behind a real domain.Work
CORS_ALLOWED_ORIGINSenvironment variable (comma-separated list of origins).config.pyand pass it to the FastAPICORSMiddlewareconfiguration inapi.py.http://localhost:3000,http://localhost:5173so local development is unaffected.README.mdor an.env.examplefile.Acceptance Criteria
CORS_ALLOWED_ORIGINS=https://sparc.example.comallows requests from that origin.References
Roadmap: P1 — Security hardening — CORS allow-origins.
This issue has already been resolved. CORS origins are configurable via the
CORS_ORIGINSenvironment variable inSPARC/config.py(lines 63-70). Thedocker-compose.ymlalso exposesCORS_ORIGINSas a configurable env var.Resolved by prior security hardening work. Closing.