Add the ability to use extra_config when base site is redirected
Change-Id: I8f289836521147fa02252a6c4cd05a9d953b11f7
diff --git a/README.md b/README.md
index 9f1b0a9..f351db7 100644
--- a/README.md
+++ b/README.md
@@ -59,7 +59,10 @@
- Complicated redirect rules. The grammar for these was too complicated to make
into a general case, so if they're required use the `extra_config` which is
loaded into the `server {}` configuration scope, and specify rules using the
- [rewrite module](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html)
+ [rewrite module](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html).
+ `extra_config` also added to the config if `strip_request_uri` is set - this
+ handles a basic full-site redirect to another URL, along with any custom 301
+ redirects in `extra_config`
- Wildcard matching of domains. These were generally done to host many sites
behind one TLS certificate, which is less needed now that we have
diff --git a/templates/vhost.conf.j2 b/templates/vhost.conf.j2
index f5e7e8a..99a4ce2 100644
--- a/templates/vhost.conf.j2
+++ b/templates/vhost.conf.j2
@@ -24,6 +24,12 @@
}
{% if item.strip_request_uri is defined and item.strip_request_uri %}
+{% if item.extra_config is defined and item.extra_config %}
+ # extra config
+ {{ item.extra_config | indent(2) }}
+
+{% endif %}
+
{% set uri = "" %}
{% else %}
{% set uri = "$request_uri" %}