mirror of
https://github.com/RGBCube/ncc
synced 2025-07-27 18:17:44 +00:00
fix: fix some nginx header issues
This commit is contained in:
parent
0dd43e11e9
commit
dad68acf68
2 changed files with 14 additions and 20 deletions
|
@ -1,4 +1,5 @@
|
|||
{ config, lib, pkgs, ... }: let
|
||||
inherit (config.networking) domain;
|
||||
inherit (lib) enabled mkConst;
|
||||
in {
|
||||
options.nginxSslTemplate = mkConst {
|
||||
|
@ -8,6 +9,10 @@ in {
|
|||
};
|
||||
|
||||
options.nginxHeaders = mkConst ''
|
||||
# TODO: Not working for some reason.
|
||||
add_header Access-Control-Allow-Origin $allow_origin;
|
||||
add_header Access-Control-Allow-Methods $allow_methods;
|
||||
|
||||
add_header Strict-Transport-Security $hsts_header;
|
||||
|
||||
add_header Content-Security-Policy "script-src 'self'; object-src 'none'; base-uri 'none';" always;
|
||||
|
@ -48,6 +53,14 @@ in {
|
|||
https "max-age=31536000; includeSubdomains; preload";
|
||||
}
|
||||
|
||||
map $http_origin $allow_origin {
|
||||
~^https://.+\.${domain}$ $http_origin;
|
||||
}
|
||||
|
||||
map $http_origin $allow_methods {
|
||||
~^https://.+\.${domain}$ "GET, HEAD, OPTIONS";
|
||||
}
|
||||
|
||||
${config.nginxHeaders}
|
||||
|
||||
proxy_cookie_path / "/; secure; HttpOnly; SameSite=strict";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue