nix-config/modules/data-hoarder/map.nix

62 lines
1.9 KiB
Nix
Raw Normal View History

{ pkgs, config, ... }: {
2022-05-02 12:38:16 +02:00
services = {
nginx = {
enable = true;
recommendedProxySettings = true;
virtualHosts = {
2022-12-30 18:29:13 +01:00
"map.${config.deployment-TLMS.domain}" = {
forceSSL = true;
2022-05-02 12:38:16 +02:00
enableACME = true;
2022-07-28 22:36:56 +02:00
extraConfig = ''
autoindex on;
'';
2022-12-09 23:16:10 +01:00
locations = let
nginx_config = ''
# Permissions Policy - gps only
add_header Permissions-Policy "geolocation=()";
# Minimize information leaked to other domains
add_header 'Referrer-Policy' 'origin-when-cross-origin';
# Disable embedding as a frame
add_header X-Frame-Options DENY;
# Prevent injection of code in other mime types (XSS Attacks)
add_header X-Content-Type-Options nosniff;
# Enable XSS protection of the browser.
# May be unnecessary when CSP is configured properly (see above)
add_header X-XSS-Protection "1; mode=block";
# STS
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
add_header "Access-Control-Allow-Origin" "*";
2023-03-05 14:07:31 +01:00
'';
json_dump = "/var/lib/json_dump/";
2022-12-09 23:16:10 +01:00
in {
2022-05-02 12:38:16 +02:00
"/" = {
2022-12-30 18:29:13 +01:00
root = if (config.deployment-TLMS.domain == "dvb.solutions") then "${pkgs.windshield}/bin/" else "${pkgs.windshield-staging}/bin/";
2022-05-02 17:37:41 +02:00
index = "index.html";
2022-10-16 15:59:17 +02:00
tryFiles = "$uri /index.html =404";
2022-05-02 12:38:16 +02:00
};
2022-10-16 18:33:46 +02:00
"~ ^/stop/.*\.json$" = {
2023-03-05 14:07:31 +01:00
root = json_dump;
2022-12-09 23:16:10 +01:00
extraConfig = nginx_config;
};
"~ ^/graph/.*\.json$" = {
2023-03-05 14:07:31 +01:00
root = json_dump;
2022-12-09 23:16:10 +01:00
extraConfig = nginx_config;
};
"~ ^/region/.*\.json$" = {
2023-03-05 14:07:31 +01:00
root = json_dump;
2022-12-09 23:16:10 +01:00
extraConfig = nginx_config;
2022-07-28 22:50:35 +02:00
};
2022-05-02 12:38:16 +02:00
};
};
};
};
};
}