From 3f8bff392fbbde415cf9e986f28cc49cd7c62c10 Mon Sep 17 00:00:00 2001 From: June Date: Mon, 28 Sep 2026 21:25:19 +0200 Subject: [PATCH] public-web-static: add configuration for www.didays.de redirect --- .../virtualHosts/didays.de.nix | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/config/hosts/public-web-static/virtualHosts/didays.de.nix b/config/hosts/public-web-static/virtualHosts/didays.de.nix index 6874e4f..bb0a852 100644 --- a/config/hosts/public-web-static/virtualHosts/didays.de.nix +++ b/config/hosts/public-web-static/virtualHosts/didays.de.nix @@ -9,6 +9,9 @@ in { "acme-${domain}" = { enableACME = true; serverName = "${domain}"; + serverAliases = [ + "www.${domain}" + ]; listen = [ { @@ -22,6 +25,41 @@ in { ]; }; + "www.${domain}" = { + forceSSL = true; + useACMEHost = "${domain}"; + + listen = [ + { + addr = "[::]"; + port = 8443; + ssl = true; + proxyProtocol = true; + } + { + addr = "0.0.0.0"; + port = 8443; + ssl = true; + proxyProtocol = true; + } + ]; + + locations."/" = { + return = "302 https://didays.de$request_uri"; + }; + + extraConfig = '' + # Make use of the ngx_http_realip_module to set the $remote_addr and + # $remote_port to the client address and client port, when using proxy + # protocol. + # First set our proxy protocol proxy as trusted. + set_real_ip_from 172.31.17.140; + # Then tell the realip_module to get the addreses from the proxy protocol + # header. + real_ip_header proxy_protocol; + ''; + }; + "${domain}" = { forceSSL = true; useACMEHost = "${domain}";