feat(nginx): Add default real_ip decoding for all vhosts
All checks were successful
build configuration / build_and_cache_geo01 (pull_request) Successful in 1m6s
build configuration / build_and_cache_geo02 (pull_request) Successful in 1m5s
build configuration / build_and_cache_storage01 (pull_request) Successful in 1m25s
build configuration / build_and_cache_rescue01 (pull_request) Successful in 1m8s
build configuration / build_and_cache_compute01 (pull_request) Successful in 1m43s
build configuration / build_and_cache_krz01 (pull_request) Successful in 2m7s
lint / check (pull_request) Successful in 24s
build configuration / build_and_cache_bridge01 (pull_request) Successful in 1m7s
build configuration / build_and_cache_web02 (pull_request) Successful in 1m14s
build configuration / build_and_cache_vault01 (pull_request) Successful in 1m25s
build configuration / build_and_cache_web01 (pull_request) Successful in 1m51s
Check meta / check_meta (pull_request) Successful in 19s
Check meta / check_dns (pull_request) Successful in 19s
lint / check (push) Successful in 23s

This commit is contained in:
Tom Hubrecht 2024-10-12 12:30:52 +02:00
parent e4cc002f6f
commit 40b8b8eabc
Signed by: thubrecht
SSH key fingerprint: SHA256:r+nK/SIcWlJ0zFZJGHtlAoRwq1Rm+WcKAm5ADYMoQPc

View file

@ -36,7 +36,18 @@ let
in in
{ {
options.services.nginx.virtualHosts = lib.mkOption {
type = lib.types.attrsOf (
lib.types.submodule {
config.extraConfig = ''
real_ip_header proxy_protocol;
set_real_ip_from 127.0.0.1;
'';
}
);
};
config = {
systemd.services.codeberg-pages = { systemd.services.codeberg-pages = {
inherit environment; inherit environment;
description = "Codeberg pages server"; description = "Codeberg pages server";
@ -81,6 +92,7 @@ in
ssl = false; ssl = false;
} }
]; ];
streamConfig = '' streamConfig = ''
map $ssl_preread_server_name $sni_upstream { map $ssl_preread_server_name $sni_upstream {
default 127.0.0.1:8010; default 127.0.0.1:8010;
@ -97,9 +109,7 @@ in
proxy_pass $sni_upstream; proxy_pass $sni_upstream;
proxy_protocol on; proxy_protocol on;
} }
''; '';
defaultSSLListenPort = 8446;
}; };
};
} }