A
A
Anatoly2016-11-05 19:55:46
Apache HTTP Server
Anatoly, 2016-11-05 19:55:46

Allow CORS Docker MPD stream?

Hello!
I am streaming audio. On the server (a.domain:8000), mpd is in docker. On the site (b.domain) the player broadcasts and there is a JS script that pulls out id3 tags.
The problem is that I can't "knock" the server from another domain due to the limitation: Access-Control-Allow-Origin. I can't figure out how to take it off.
Made

<location /stream>
 Header always set Access-Control-Allow-Origin: "*"
 ProxyPass http://127.0.0.1:8000

But then the error is:
Refused to get unsafe header "Content-Length"
XMLHttpRequest cannot load loc/stream. Response for preflight has invalid HTTP status code 502

As I understand it, content-lenght, because this is a stream, I don’t know what title is needed.
On error 502, there is information that the upstream server returned an error. Interestingly, the stream works as it should in the browser, but it is interrupted through VLC and the id3 player does not pick up tags (only through proxyPass), although aimp (apparently it has a larger buffer) plays stably and displays tags.
While writing this post, simultaneously implementing incoming thoughts on this topic, I added to the location
Header always set Access-Control-Expose-Headers: "Content-Length"

The error with "Refused to get unsafe header" is probably resolved.
Ubuntu 16.04, Apache 2.4

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question