From 758e1e783c3c0c0ea3350eba42741fe84d9ad89d Mon Sep 17 00:00:00 2001 From: sum12 Date: Mon, 16 Mar 2020 00:32:04 +0100 Subject: [PATCH] allowing adding aliases to the proxies domain with this nginx will keep on proxying requests and serve static content instead of passing this responsibility to proxied server Without this the one needs to run an additional server to server static content on the proxied url --- management/web_update.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/management/web_update.py b/management/web_update.py index 72295c21..e2498e77 100644 --- a/management/web_update.py +++ b/management/web_update.py @@ -159,6 +159,10 @@ def make_domain_config(domain, templates, ssl_certificates, env): 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, alias in yaml.get("aliases", {}).items(): + nginx_conf_extra += "\tlocation %s {" % path + nginx_conf_extra += "\n\t\talias %s;" % alias + nginx_conf_extra += "\n\t}\n" for path, url in yaml.get("redirects", {}).items(): nginx_conf_extra += "\trewrite %s %s permanent;\n" % (path, url)