From d0b4816a5f3a62c6b2687c33b7a665bc5dabf0b1 Mon Sep 17 00:00:00 2001 From: Hampus Date: Thu, 8 Oct 2026 23:21:10 +0200 Subject: [PATCH] fix(media-proxy): allow the desktop app origin and preflight (#3325) --- .../src/content/docs/media-proxy/overview.md | 4 +- .../content/docs/operator/configuration.mdx | 2 +- fluxer_media_proxy/src/config/parse.rs | 5 +- fluxer_media_proxy/src/config/tests/cors.rs | 11 +- fluxer_media_proxy/src/constants.rs | 1 + fluxer_media_proxy/src/server/cors.rs | 47 +++++- .../src/server/routes/dispatch.rs | 154 +++++++++++++++++- 7 files changed, 218 insertions(+), 6 deletions(-) diff --git a/fluxer_docs/src/content/docs/media-proxy/overview.md b/fluxer_docs/src/content/docs/media-proxy/overview.md index 554843835..fc900b653 100644 --- a/fluxer_docs/src/content/docs/media-proxy/overview.md +++ b/fluxer_docs/src/content/docs/media-proxy/overview.md @@ -91,10 +91,12 @@ An operator can limit which web origins read media through CORS. `FLUXER_MEDIA_P | `report` | Every response is the same as under `off`, and each read `enforce` would refuse is logged | | `enforce` | A read from an origin outside the allowlist returns 403 | -Under `enforce`, an `Origin` is allowed when it equals the serialised form of an entry in `FLUXER_MEDIA_PROXY_CORS_ALLOWED_ORIGINS` byte for byte. Anything else is refused, including `null`, a repeated `Origin` header, and a value that is not ASCII. A refused read returns 403 on every read path, and the Media Proxy reads no object and fetches no external URL for it. [Media Proxy settings](/operator/configuration/#media-proxy-settings) defines how an entry is parsed and serialised. +Under `enforce`, an `Origin` is allowed when it equals the serialised form of an entry in `FLUXER_MEDIA_PROXY_CORS_ALLOWED_ORIGINS` byte for byte. The desktop app origin `fluxer-app://app` is always allowed and needs no entry. Anything else is refused, including `null`, a repeated `Origin` header, and a value that is not ASCII. A refused read returns 403 on every read path, and the Media Proxy reads no object and fetches no external URL for it. [Media Proxy settings](/operator/configuration/#media-proxy-settings) defines how an entry is parsed and serialised. A read with no `Origin` is served without `Access-Control-Allow-Origin`. A browser sends no `Origin` for an `` or a `