Skip to content

Add CORS headers to static file responses - #2287

Open
srushtigm25 wants to merge 1 commit into
mopidy:mainfrom
srushtigm25:fix-static-file-cors
Open

Add CORS headers to static file responses#2287
srushtigm25 wants to merge 1 commit into
mopidy:mainfrom
srushtigm25:fix-static-file-cors

Conversation

@srushtigm25

Copy link
Copy Markdown

Fixes #1953

This adds CORS headers to static file responses when the request origin is allowed by the HTTP configuration.

The change:

passes allowed_origins to static file handlers
validates the request origin using the existing check_origin() logic
adds Access-Control-Allow-Origin for allowed origins
adds test coverage for CORS headers on static file responses

Tests:

pytest tests/_exts/http/ (103 passed)
ruff check .
ty check src/mopidy/_exts/http/handlers.py
git diff --check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing CORS response header for static file assets

1 participant