2020-11-29 12:54:35 +00:00
|
|
|
{config, lib, pkgs, ...}:
|
|
|
|
|
|
|
|
{
|
|
|
|
imports = [
|
|
|
|
./common.nix
|
|
|
|
];
|
|
|
|
services.nginx = {
|
|
|
|
virtualHosts."${config.networking.hostName}.live.hacc.media" = {
|
|
|
|
locations = {
|
|
|
|
"/" = {
|
2020-12-01 20:37:02 +00:00
|
|
|
return = "301 \"https://$cdnhosts$request_uri\"";
|
2020-11-29 12:54:35 +00:00
|
|
|
extraConfig = ''
|
|
|
|
auth_basic off;
|
2020-12-02 18:30:51 +00:00
|
|
|
add_header 'Access-Control-Allow-Origin' '*';
|
2020-11-29 12:54:35 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
appendHttpConfig = ''
|
|
|
|
split_clients "$remote_addr" $cdnhosts {
|
|
|
|
50% "cdn-node-1.live.hacc.media";
|
|
|
|
50% "cdn-node-2.live.hacc.media";
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|