1
Fork 0
mirror of https://github.com/RGBCube/ncc synced 2025-07-30 11:37:44 +00:00
This commit is contained in:
RGBCube 2024-02-26 14:15:21 +03:00
parent a07bdb0730
commit f4abc22f9c
No known key found for this signature in database

View file

@ -10,12 +10,30 @@ let
locations."= /404.html".extraConfig = "internal;"; locations."= /404.html".extraConfig = "internal;";
}; };
in serverSystemConfiguration { in serverSystemConfiguration {
services.nginx.appendHttpConfig = ''
map $http_origin $allow_origin {
~^https://.+\.rgbcu.be$ $http_origin;
}
map $http_origin $allow_methods {
~^https://.+\.rgbcu.be$ "GET, HEAD, OPTIONS";
}
'';
services.nginx.virtualHosts.${domain} = ulib.recursiveUpdateAll [ (sslTemplate domain) notFoundLocationConfig { services.nginx.virtualHosts.${domain} = ulib.recursiveUpdateAll [ (sslTemplate domain) notFoundLocationConfig {
root = "${path}"; root = "${path}";
locations."/".tryFiles = "$uri $uri.html $uri/index.html =404"; locations."/".tryFiles = "$uri $uri.html $uri/index.html =404";
locations."/assets/".extraConfig = '' locations."/assets/".extraConfig = ''
add_header Access-Control-Allow-Origin *.rgbcu.be; add_header Access-Control-Allow-Origin $allow_origin;
add_header Access-Control-Allow-Methods $allow_methods;
if ($request_method = OPTIONS) {
add_header Content-Type text/plain;
add_header Content-Length 0;
return 204;
}
expires 24h; expires 24h;
''; '';