QuestionDescriptionWhen a browser application is served from a different origin than the MediaMTX MediaMTX unconditionally performs a session cookie-check for every HLS client.
Steps to reproduce
Expected behaviourWhen Actual behaviour
Question / RequestIs there a configuration option to:
Environment
Version: MediaMTX v1.20.0, windows, amd64 |
Replies: 4 comments 1 reply
|
There are two separate cases here. For hls.js in Chrome/Firefox/etc, you normally should not set So for a browser using hls.js, try: const hls = new Hls({
// no xhrSetup with withCredentials=true
});and in MediaMTX: hlsAllowOrigins:
- https://your-frontend.exampleThe error text about "HLS on iOS requires..." is specifically the iOS/native-HLS branch, because native iOS HLS needs the cookie check to work. MediaMTX currently sets For iOS/Safari native HLS, the practical workaround is to serve the player and HLS endpoint from the same origin, usually through a reverse proxy. For hls.js-capable browsers, keep credentials disabled and let the non-iOS query-token fallback handle the session. If this matches what you are seeing, please mark the answer so the credentialed-CORS vs hls.js distinction is visible. |
|
Hello, we were forced to remove When performing cross-origin requests with XHR or fetch(), browsers do not offer a way to partition cookies by origin domain and target domain at the same time - cookies are partitioned by target domain only, so they are always shared regardless of the origin. This problem is not present when loading resources with I-frames, since they introduced CHIPS, that perform the proper cookie partitioning and that we support. Therefore:
|
|
but without credentials true I reveive the error: or using the url: |
|
I fixed this by having my frontend proxy inject the Access-Control-Allow-Credentials header. Apache httpd config:
|
Using HLS URLs inside video tags is something that we never officially supported in the first place. Use one of the integration methods described in the documentation.