the hidden feature for proxying web requests now sets X-Forwarded-For

This commit is contained in:
Joshua Tauberer 2018-02-24 07:54:32 -05:00
parent 5eb4a53de1
commit 08becf7fa3
2 changed files with 5 additions and 1 deletions

View 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)
--------------------------

View 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)