git.iko.soy/typeable/nixpkgs
on master help sign in
security.acme: remove loop when no fallbackHost is given
commite84b803300033a030907f351b5a5c6fa671b7bf6 authorAlexander Ried <ried@mytum.de> dateTue 6 Sep 2016, 17:45 (10 years ago) parent7f98dca
2 files changed+6−5
nixos/modules/services/web-servers/nginx/default.nix+4−3 nixos/modules/services/web-servers/nginx/vhost-options.nix+2−2
nixos/modules/services/web-servers/nginx/default.nix+4−3
@@ -114,17 +114,18 @@ let
114114 port = if vhost.port != null then vhost.port else (if ssl then 443 else 80);
115115 listenString = toString port + optionalString ssl " ssl http2"
116116 + optionalString vhost.default " default";
117− acmeLocation = optionalString vhost.enableACME ''
117+ acmeLocation = optionalString vhost.enableACME (''
118118 location /.well-known/acme-challenge {
119− try_files $uri @acme-fallback;
119+ ${optionalString (vhost.acmeFallbackHost != null) "try_files $uri @acme-fallback;"}
120120 root ${vhost.acmeRoot};
121121 auth_basic off;
122122 }
123+ '' + (optionalString (vhost.acmeFallbackHost != null) ''
123124 location @acme-fallback {
124125 auth_basic off;
125126 proxy_pass http://${vhost.acmeFallbackHost};
126127 }
127− '';
128+ ''));
128129 in ''
129130 ${optionalString vhost.forceSSL ''
130131 server {
nixos/modules/services/web-servers/nginx/vhost-options.nix+2−2
@@ -39,8 +39,8 @@ with lib;
3939 };
4040
4141 acmeFallbackHost = mkOption {
42− type = types.str;
43− default = "0.0.0.0";
42+ type = types.nullOr types.str;
43+ default = null;
4444 description = ''
4545 Host which to proxy requests to if acme challenge is not found. Useful
4646 if you want multiple hosts to be able to verify the same domain name.