SurfSense icon indicating copy to clipboard operation
SurfSense copied to clipboard

[idea] Docker 01/14: CORS origins setting

Open AnishSarkar22 opened this issue 2 months ago • 1 comments

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: add SURFSENSE_LOCAL_CORS_ORIGINS, a comma-separated list, default *.
  • surfsense_local/backend/api/main.py: pass it to CORSMiddleware instead 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 Origin header gets no Access-Control-Allow-Origin back.
  • [ ] A unit test covers both, and uv run pytest -m unit passes.

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.

AnishSarkar22 avatar Oct 01 '26 05:10 AnishSarkar22

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.

qwist1233-cpu avatar Oct 01 '26 08:10 qwist1233-cpu