nix-config/hosts/cloud/proxy/auth.nix

37 lines
1.1 KiB
Nix
Raw Normal View History

{ ... }:
{
2025-01-21 00:16:31 +00:00
services.nginx.upstreams.authentik = {
servers = {
2025-01-21 00:16:31 +00:00
"10.89.88.11:9000" = { };
"[fd31:185d:722f::11]:9000" = { };
};
2025-01-21 00:16:31 +00:00
extraConfig = ''
keepalive 10;
'';
};
services.nginx.virtualHosts."auth.oxapentane.com" = {
forceSSL = true;
enableACME = true;
locations."/" = {
2025-01-21 00:16:31 +00:00
proxyPass = "http://authentik";
extraConfig = ''
2025-01-21 00:16:31 +00:00
# general proxy settings
2025-01-25 15:37:01 +01:00
proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
proxy_http_version 1.1;
2025-01-21 00:16:31 +00:00
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
# authentik specifik
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade_keepalive;
'';
};
};
}