mirror of
https://github.com/RGBCube/ncc
synced 2025-07-30 11:37:44 +00:00
CORS!!!!
This commit is contained in:
parent
a07bdb0730
commit
f4abc22f9c
1 changed files with 20 additions and 2 deletions
|
@ -10,12 +10,30 @@ let
|
|||
locations."= /404.html".extraConfig = "internal;";
|
||||
};
|
||||
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 {
|
||||
root = "${path}";
|
||||
|
||||
locations."/".tryFiles = "$uri $uri.html $uri/index.html =404";
|
||||
locations."/".tryFiles = "$uri $uri.html $uri/index.html =404";
|
||||
|
||||
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;
|
||||
'';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue