add a 'redirects' feature in web/custom.yaml

This commit is contained in:
Joshua Tauberer 2014-12-05 11:57:26 -05:00
parent 31d6128a2b
commit cfe0fa912a
1 changed files with 2 additions and 0 deletions

View File

@ -115,6 +115,8 @@ def make_domain_config(domain, template, template_for_primaryhost, env):
yaml = yaml[domain] yaml = yaml[domain]
for path, url in yaml.get("proxies", {}).items(): for path, url in yaml.get("proxies", {}).items():
nginx_conf += "\tlocation %s {\n\t\tproxy_pass %s;\n\t}\n" % (path, url) nginx_conf += "\tlocation %s {\n\t\tproxy_pass %s;\n\t}\n" % (path, url)
for path, url in yaml.get("redirects", {}).items():
nginx_conf += "\trewrite %s %s permanent;\n" % (path, url)
# Add in any user customizations in the includes/ folder. # Add in any user customizations in the includes/ folder.
nginx_conf_custom_include = os.path.join(env["STORAGE_ROOT"], "www", safe_domain_name(domain) + ".conf") nginx_conf_custom_include = os.path.join(env["STORAGE_ROOT"], "www", safe_domain_name(domain) + ".conf")