l paste: try to fix CORS

This commit is contained in:
lassulus 2023-09-03 12:09:51 +02:00
parent c1b812509e
commit fd5615dd22

View File

@ -10,8 +10,8 @@ with import <stockholm/lib>;
proxy_pass http://127.0.0.1:${toString config.krebs.htgen.cyberlocker.port}; proxy_pass http://127.0.0.1:${toString config.krebs.htgen.cyberlocker.port};
''; '';
extraConfig = '' extraConfig = ''
add_header 'Access-Control-Allow-Origin' '*'; add_header Access-Control-Allow-Origin * always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
''; '';
}; };
services.nginx.virtualHosts.paste = { services.nginx.virtualHosts.paste = {
@ -48,8 +48,8 @@ with import <stockholm/lib>;
proxy_pass http://127.0.0.1:${toString config.krebs.htgen.cyberlocker.port}; proxy_pass http://127.0.0.1:${toString config.krebs.htgen.cyberlocker.port};
''; '';
extraConfig = '' extraConfig = ''
add_header 'Access-Control-Allow-Origin' '*'; add_header Access-Control-Allow-Origin * always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS' always;
''; '';
}; };
services.nginx.virtualHosts."p.krebsco.de" = { services.nginx.virtualHosts."p.krebsco.de" = {
@ -57,6 +57,10 @@ with import <stockholm/lib>;
addSSL = true; addSSL = true;
serverAliases = [ "p.krebsco.de" ]; serverAliases = [ "p.krebsco.de" ];
locations."/".extraConfig = '' locations."/".extraConfig = ''
if ($request_method = 'OPTIONS') {
return 204;
}
client_max_body_size 4G;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://127.0.0.1:${toString config.krebs.htgen.paste.port}; proxy_pass http://127.0.0.1:${toString config.krebs.htgen.paste.port};
@ -75,8 +79,9 @@ with import <stockholm/lib>;
proxy_pass_header Server; proxy_pass_header Server;
''; '';
extraConfig = '' extraConfig = ''
add_header 'Access-Control-Allow-Origin' '*'; add_header Access-Control-Allow-Headers Authorization always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; add_header Access-Control-Allow-Origin * always;
add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS' always;
''; '';
}; };