livecdn: add CORS

close !6

commit 77ed77aa93
Author: Lukas Schulz <lukas.schulz@simiworld.de>
Date:   Tue Dec 1 21:33:13 2020 +0100

    repositioned second CORS header

commit fe01c721a6
Author: Lukas Schulz <lukas.schulz@simiworld.de>
Date:   Tue Dec 1 21:32:36 2020 +0100

    escaped '

commit 6b50ef9de5
Author: Lukas Schulz <lukas.schulz@simiworld.de>
Date:   Tue Dec 1 21:28:24 2020 +0100

    repositioned cors header

commit cdaad1a973
Author: Lukas Schulz <lukas.schulz@simiworld.de>
Date:   Tue Dec 1 21:25:29 2020 +0100

    added cors header

commit bc30682b9e
Author: Lukas Schulz <lukas.schulz@simiworld.de>
Date:   Tue Dec 1 21:21:15 2020 +0100

    changed cdn-url to https to fix mixed content stuff

Signed-off-by: hexchen <hexchen@lilwit.ch>
This commit is contained in:
hexchen 2020-12-01 20:37:02 +00:00
parent 51d17d27d8
commit cafbe5bb79
2 changed files with 5 additions and 1 deletions

View file

@ -8,7 +8,7 @@
virtualHosts."${config.networking.hostName}.live.hacc.media" = { virtualHosts."${config.networking.hostName}.live.hacc.media" = {
locations = { locations = {
"/" = { "/" = {
return = "301 \"http://$cdnhosts$request_uri\""; return = "301 \"https://$cdnhosts$request_uri\"";
extraConfig = '' extraConfig = ''
auth_basic off; auth_basic off;
''; '';

View file

@ -10,14 +10,17 @@ in {
virtualHosts."${config.networking.hostName}.live.hacc.media" = { virtualHosts."${config.networking.hostName}.live.hacc.media" = {
locations = { locations = {
"~* \\.(m3u8)$" = { "~* \\.(m3u8)$" = {
proxyPass = "${host-server}$request_uri"; proxyPass = "${host-server}$request_uri";
extraConfig = '' extraConfig = ''
#proxy_cache = off; #proxy_cache = off;
expires 2s; expires 2s;
auth_basic off; auth_basic off;
add_header 'Access-Control-Allow-Origin' '*';
''; '';
}; };
"/hls" = { "/hls" = {
proxyPass = "${host-server}$request_uri"; proxyPass = "${host-server}$request_uri";
extraConfig = '' extraConfig = ''
types { types {
@ -28,6 +31,7 @@ in {
proxy_ignore_headers Cache-Control; proxy_ignore_headers Cache-Control;
proxy_cache_valid any 30m; proxy_cache_valid any 30m;
auth_basic off; auth_basic off;
add_header 'Access-Control-Allow-Origin' '*';
''; '';
}; };
}; };