haccfiles/configuration/server/cdn/cdn-master.nix
hexchen cafbe5bb79 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>
2020-12-01 20:37:02 +00:00

44 lines
1.1 KiB
Nix

{config, lib, pkgs, ...}:
let
host-server = "https://rosenbaum.lukas.studio";
in {
imports = [
./common.nix
];
services.nginx = {
virtualHosts."${config.networking.hostName}.live.hacc.media" = {
locations = {
"~* \\.(m3u8)$" = {
proxyPass = "${host-server}$request_uri";
extraConfig = ''
#proxy_cache = off;
expires 2s;
auth_basic off;
add_header 'Access-Control-Allow-Origin' '*';
'';
};
"/hls" = {
proxyPass = "${host-server}$request_uri";
extraConfig = ''
types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
proxy_cache hls;
proxy_ignore_headers Cache-Control;
proxy_cache_valid any 30m;
auth_basic off;
add_header 'Access-Control-Allow-Origin' '*';
'';
};
};
};
appendHttpConfig = ''
proxy_cache_path /tmp keys_zone=hls:10m max_size=10g inactive=60m use_temp_path=on;
resolver 1.1.1.1;
'';
};
}