Im trying to stream music from my icecast2 server using Dancer.js which is using XHR.
However, currently I'm getting the error (replaced the actual domain with example.com):
XMLHttpRequest cannot load http://example.com:8000/stream.ogg. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://example.com' is therefore not allowed access.
I have been searching around for information on how to add custom headers to the stream, but couldn't find any information about this.
How can I add the access-control-allow-origin header to this stream?
I saw some anwsers telling me to add it in the apache config or .htaccess but since this isn't using the apache service that wouldn't work.
Thanks.
The properâ„¢ way to do this is to upgrade to Icecast 2.4.1 which has this feature explicitly added to aid the use of it's (fixed) JSON API and HTML5 features.
Packages are available for most distributions. See http://icecast.org