From 73fdaee1d91cbec1574a4642ec0c8b0aeba4726c Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 25 Oct 2018 12:37:17 +0200 Subject: [PATCH] support the case for smartgears_special_redirect --- .../templates/generic-smartgears-virtualhost.j2 | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/smartgears/smartgears-nginx-frontend/templates/generic-smartgears-virtualhost.j2 b/smartgears/smartgears-nginx-frontend/templates/generic-smartgears-virtualhost.j2 index 87daa580..77ce064c 100644 --- a/smartgears/smartgears-nginx-frontend/templates/generic-smartgears-virtualhost.j2 +++ b/smartgears/smartgears-nginx-frontend/templates/generic-smartgears-virtualhost.j2 @@ -165,13 +165,19 @@ server { proxy_pass http://127.0.0.1:{{ smartgears_http_port }}/$uri; } {% endif %} + {% if smartgears_special_redirect is defined %} + {% for target in smartgears_special_redirect %} + location {{ target.source_uri }} { + return 301 http://{{ target.dest_host }}/{{ target.dest_url }}; + } + {% endfor %} + {% endif %} {% else %} location / { return 301 https://{{ item.servername }}$request_uri; } {% endif %} - } {% if letsencrypt_acme_install %} @@ -343,6 +349,12 @@ server { proxy_pass http://127.0.0.1:{{ smartgears_http_port }}/$uri; } {% endif %} - + {% if smartgears_special_redirect is defined %} + {% for target in smartgears_special_redirect %} + location {{ target.source_uri }} { + return 301 http://{{ target.dest_host }}/{{ target.dest_url }}; + } + {% endfor %} + {% endif %} } {% endif %}