fix: remove unnecessary if statement when redirect annotation is defined

This commit is contained in:
Artem Miroshnychenko 2020-04-08 19:02:15 +03:00
parent 2cc828213d
commit eefb32c667

View file

@ -1136,12 +1136,6 @@ stream {
{{ buildInfluxDB $location.InfluxDB }} {{ 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 }} {{ if isValidByteSize $location.Proxy.BodySize true }}
client_max_body_size {{ $location.Proxy.BodySize }}; client_max_body_size {{ $location.Proxy.BodySize }};
{{ end }} {{ end }}
@ -1267,6 +1261,10 @@ stream {
fastcgi_param {{ $k }} {{ $v | quote }}; fastcgi_param {{ $k }} {{ $v | quote }};
{{ end }} {{ end }}
{{ if not (empty $location.Redirect.URL) }}
return {{ $location.Redirect.Code }} {{ $location.Redirect.URL }};
{{ end }}
{{ buildProxyPass $server.Hostname $all.Backends $location }} {{ buildProxyPass $server.Hostname $all.Backends $location }}
{{ if (or (eq $location.Proxy.ProxyRedirectFrom "default") (eq $location.Proxy.ProxyRedirectFrom "off")) }} {{ if (or (eq $location.Proxy.ProxyRedirectFrom "default") (eq $location.Proxy.ProxyRedirectFrom "off")) }}
proxy_redirect {{ $location.Proxy.ProxyRedirectFrom }}; proxy_redirect {{ $location.Proxy.ProxyRedirectFrom }};