diff options
author | Robin Gloster <mail@glob.in> | 2017-04-15 23:21:44 +0200 |
---|---|---|
committer | Robin Gloster <mail@glob.in> | 2017-08-30 21:01:53 +0200 |
commit | 7cd46a05943bfd86a46a3d99a1d85a2a028d4d2c (patch) | |
tree | e3d0597b9939a94f584cb60054dadbe757cfe30e | |
parent | 4ffa9ddb30726808416ecb26a4389b1d2ac6337e (diff) | |
download | nixlib-7cd46a05943bfd86a46a3d99a1d85a2a028d4d2c.tar nixlib-7cd46a05943bfd86a46a3d99a1d85a2a028d4d2c.tar.gz nixlib-7cd46a05943bfd86a46a3d99a1d85a2a028d4d2c.tar.bz2 nixlib-7cd46a05943bfd86a46a3d99a1d85a2a028d4d2c.tar.lz nixlib-7cd46a05943bfd86a46a3d99a1d85a2a028d4d2c.tar.xz nixlib-7cd46a05943bfd86a46a3d99a1d85a2a028d4d2c.tar.zst nixlib-7cd46a05943bfd86a46a3d99a1d85a2a028d4d2c.zip |
nginx module: add proxyResolveWhileRunning option
-rw-r--r-- | nixos/modules/services/web-servers/nginx/default.nix | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/nixos/modules/services/web-servers/nginx/default.nix b/nixos/modules/services/web-servers/nginx/default.nix index 249b660d8c68..a9ee6255fd40 100644 --- a/nixos/modules/services/web-servers/nginx/default.nix +++ b/nixos/modules/services/web-servers/nginx/default.nix @@ -223,7 +223,13 @@ let ) virtualHosts); mkLocations = locations: concatStringsSep "\n" (mapAttrsToList (location: config: '' location ${location} { - ${optionalString (config.proxyPass != null) "proxy_pass ${config.proxyPass};"} + ${optionalString (config.proxyPass != null && !cfg.proxyResolveWhileRunning) + "proxy_pass ${config.proxyPass};" + } + ${optionalString (config.proxyPass != null && cfg.proxyResolveWhileRunning) '' + set $nix_proxy_target "${config.proxyPass}"; + proxy_pass $nix_proxy_target; + ''} ${optionalString config.proxyWebsockets '' proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; @@ -426,6 +432,16 @@ in description = "Path to DH parameters file."; }; + proxyResolveWhileRunning = mkOption { + type = types.bool; + default = false; + description = '' + Resolves domains of proxyPass targets at runtime + and not only at start, you have to set + services.nginx.resolver, too. + ''; + }; + resolver = mkOption { type = types.submodule { options = { |