[idea] Docker 01/14: CORS origins setting
Which part? Desktop app
What would you like?
Step 1 of 14 of #2100: running SurfSense in Docker. This is the first step.
Let the API's allowed CORS origins come from the environment, so the Docker image can turn cross-origin access off while the desktop app keeps *.
Design: Docker proposal, Caddy and access
What to change
surfsense_local/backend/api/config.py: addSURFSENSE_LOCAL_CORS_ORIGINS, a comma-separated list, default*.surfsense_local/backend/api/main.py: pass it toCORSMiddlewareinstead of the hard-coded["*"]. An empty value adds no CORS headers.
Done when
- [ ] With the variable unset, the desktop app works as before (its window loads from
file://). - [ ] With it set empty, a request carrying an
Originheader gets noAccess-Control-Allow-Originback. - [ ] A unit test covers both, and
uv run pytest -m unitpasses.
Scope: code and tests only. Don't edit docs/ or AGENTS.md, except to fix a link this change breaks; the maintainers update the docs when the Docker work ships.
Why would it help?
Each step leaves something that runs, so the Docker image is built and reviewed one piece at a time.
Taking this one. Will add SURFSENSE_LOCAL_CORS_ORIGINS (comma-separated, default *, empty = no CORS headers) with unit tests for both cases, PR against dev.