forked from 0xWheatyz/SPARC
Make CORS allowed origins configurable via environment variable #132
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.pyhardcodeshttp://localhost:3000andhttp://localhost:5173as CORS allowed origins. This prevents the frontend from functioning when deployed behind a real domain.Work
CORS_ORIGINSenvironment variable (comma-separated list of allowed origins).CORS_ORIGINSinconfig.pyand pass the resulting list to theCORSMiddlewareinapi.py.http://localhost:3000,http://localhost:5173for local development.CORS_ORIGINSin.env.example.Acceptance Criteria
CORS_ORIGINS=https://sparc.example.comallows requests from that origin.CORS_ORIGINSis not set.api.py.References
Roadmap: P1 — Security hardening — CORS allow-origins hardcoded.
Closing: CORS allowed origins are configurable via CORS_ORIGINS environment variable in config.py and applied in api.py. Resolved.