summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbitkeeper <bitkeeper@users.noreply.github.com>2021-03-09 18:33:05 +0100
committerMax Kellermann <max@musicpd.org>2021-03-10 21:27:19 +0100
commitc08a8581eed767564d1afe359fdcf6ccbdb4d744 (patch)
tree85448a5ef1516c205a2540cd2fe86687f710b116 /src
parent25b01940369d746debd0240bcab617b3451aa8c3 (diff)
Added cross-origin header to http headers of the http output.
The current http output doesn't provide a header for cross-origin support. This prevents to use the mpd http stream directly from an other webapplication due the origin from the webpage differs from then the audio stream. The fix is to add the following header to the http response: Access-Control-Allow-Origin: *
Diffstat (limited to 'src')
-rw-r--r--src/output/plugins/httpd/HttpdClient.cxx1
-rw-r--r--src/output/plugins/httpd/IcyMetaDataServer.cxx1
2 files changed, 2 insertions, 0 deletions
diff --git a/src/output/plugins/httpd/HttpdClient.cxx b/src/output/plugins/httpd/HttpdClient.cxx
index 8a88b131d..dbe8f63fa 100644
--- a/src/output/plugins/httpd/HttpdClient.cxx
+++ b/src/output/plugins/httpd/HttpdClient.cxx
@@ -162,6 +162,7 @@ HttpdClient::SendResponse() noexcept
"Connection: close\r\n"
"Pragma: no-cache\r\n"
"Cache-Control: no-cache, no-store\r\n"
+ "Access-Control-Allow-Origin: *\r\n"
"\r\n",
httpd.content_type);
response = buffer;
diff --git a/src/output/plugins/httpd/IcyMetaDataServer.cxx b/src/output/plugins/httpd/IcyMetaDataServer.cxx
index d746d0a0a..1323b486f 100644
--- a/src/output/plugins/httpd/IcyMetaDataServer.cxx
+++ b/src/output/plugins/httpd/IcyMetaDataServer.cxx
@@ -45,6 +45,7 @@ icy_server_metadata_header(const char *name,
"Connection: close\r\n"
"Pragma: no-cache\r\n"
"Cache-Control: no-cache, no-store\r\n"
+ "Access-Control-Allow-Origin: *\r\n"
"\r\n",
name,
genre,