the hidden feature for proxying web requests now sets X-Forwarded-For
authorJoshua Tauberer <jt@occams.info>
Sat, 24 Feb 2018 12:54:32 +0000 (07:54 -0500)
committerJoshua Tauberer <jt@occams.info>
Sat, 24 Feb 2018 14:24:14 +0000 (09:24 -0500)
CHANGELOG.md
management/web_update.py

index 2e85c20..5101a9d 100644 (file)
@@ -5,6 +5,7 @@ In Development
 --------------
 
 * Update Roundcube to version 1.3.4 and Z-Push to version 2.3.9.
+* The undocumented feature for proxying web requests to another server now sets X-Forwarded-For.
 
 v0.26c (February 13, 2018)
 --------------------------
index 450ca7c..1bd28e3 100644 (file)
@@ -149,7 +149,10 @@ def make_domain_config(domain, templates, ssl_certificates, env):
 
                        # any proxy or redirect here?
                        for path, url in yaml.get("proxies", {}).items():
-                               nginx_conf_extra += "\tlocation %s {\n\t\tproxy_pass %s;\n\t}\n" % (path, url)
+                               nginx_conf_extra += "\tlocation %s {" % path
+                               nginx_conf_extra += "\n\t\tproxy_pass %s;" % url
+                               nginx_conf_extra += "\n\t\tproxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;"
+                               nginx_conf_extra += "\n\t}\n"
                        for path, url in yaml.get("redirects", {}).items():
                                nginx_conf_extra += "\trewrite %s %s permanent;\n" % (path, url)