karlheyes / icecast-kh

KH branch of icecast
GNU General Public License v2.0
298 stars 107 forks source link

Sending CORS header in icecast-kh 2.4 #297

Closed dansteingart closed 4 years ago

dansteingart commented 4 years ago

(quick thanks for excellent work KH!)

I am new to the kh branch and I cannot enable CORS out of the box. In the standard icecast XML it is enabled by the lines

    <http-headers>
        <header name="Access-Control-Allow-Origin" value="*" />
    </http-headers>

But as I found out reading through the issues the icecast-kh branch does not support these headers.

Subsequently, when I try to access the streams through a web browser (I am making an application where the html files are served elsewhere from the stream), chrome throws these errors:

Access to audio at 'https://icecast-kh.host/mount' 
from origin 'https://html.host' has been blocked by CORS policy: 
No 'Access-Control-Allow-Origin' header is present on the requested resource.

Given that it is clear CORS works in this branch, how do I enable it? Thank you.

karlheyes commented 4 years ago

That header should be present without any xml needed but you have not said the version and browsers can be messy regarding the request they make. check the response you currently get with

curl -v -o /dev/null http://icecast-kh.host/mount

ctrl-C to stop. The headers should be displayed. Let me also know what the access log reports for your chrome attempt.

karl

dansteingart commented 4 years ago

thanks so much, just figured it out: I wasn't serving the .xslt files correctly.