From eefb32c667afe7ec9c3791ec325c10707d3d4e17 Mon Sep 17 00:00:00 2001 From: Artem Miroshnychenko Date: Wed, 8 Apr 2020 19:02:15 +0300 Subject: [PATCH] fix: remove unnecessary if statement when redirect annotation is defined --- rootfs/etc/nginx/template/nginx.tmpl | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/rootfs/etc/nginx/template/nginx.tmpl b/rootfs/etc/nginx/template/nginx.tmpl index e638672a3..cef735766 100755 --- a/rootfs/etc/nginx/template/nginx.tmpl +++ b/rootfs/etc/nginx/template/nginx.tmpl @@ -1136,12 +1136,6 @@ stream { {{ buildInfluxDB $location.InfluxDB }} - {{ if not (empty $location.Redirect.URL) }} - if ($uri ~* {{ stripLocationModifer $path }}) { - return {{ $location.Redirect.Code }} {{ $location.Redirect.URL }}; - } - {{ end }} - {{ if isValidByteSize $location.Proxy.BodySize true }} client_max_body_size {{ $location.Proxy.BodySize }}; {{ end }} @@ -1267,6 +1261,10 @@ stream { fastcgi_param {{ $k }} {{ $v | quote }}; {{ end }} + {{ if not (empty $location.Redirect.URL) }} + return {{ $location.Redirect.Code }} {{ $location.Redirect.URL }}; + {{ end }} + {{ buildProxyPass $server.Hostname $all.Backends $location }} {{ if (or (eq $location.Proxy.ProxyRedirectFrom "default") (eq $location.Proxy.ProxyRedirectFrom "off")) }} proxy_redirect {{ $location.Proxy.ProxyRedirectFrom }};