* Add possibity to just have a location with a return in it.
This commit is contained in:
Philip Henning 2019-07-17 14:10:09 +02:00 committed by Grzegorz Dzien
parent 42f776f7d8
commit a8b7fff7fc
4 changed files with 25 additions and 0 deletions

View File

@ -550,6 +550,14 @@ nginx_http_template:
port: 8081
weight: 1
health_check: max_fails=1 fail_timeout=10s
returns:
return301:
location: /
code: 301
value: http://$host$request_uri
return404:
location: /setup
code: 404
# Enable NGINX status data.
# Will enable 'stub_status' in NGINX Open Source and 'status' in NGINX Plus.

View File

@ -362,6 +362,11 @@ nginx_http_template:
port: 8081
weight: 1
health_check: max_fails=1 fail_timeout=10s
returns:
return301:
location: /
code: 301
value: http://$host$request_uri
# Enable NGINX status data.
# Will enable 'stub_status' in NGINX Open Source and 'status' in NGINX Plus.

View File

@ -352,6 +352,13 @@ server {
sub_filter 'proxied_for_ip' '$http_x_forwarded_for';
{% endif %}
{% endif %}
{% if item.value.returns is defined %}
{% for return in item.value.returns %}
location {{ item.value.returns[return].location }} {
return {{ item.value.returns[return].code }}{% if item.value.returns[return].value is defined %} {{ item.value.returns[return].value }}{% endif %};
}
{% endfor %}
{% endif %}
{% if item.value.error_page is defined %}
# redirect server error pages to the static page /50x.html
#

View File

@ -147,6 +147,11 @@
port: 8082
weight: 1
health_check: max_fails=3 fail_timeout=5s
returns:
return301:
location: ^~ /old-path
code: 301
value: http://$host/new-path
frontend:
template_file: http/default.conf.j2
conf_file_name: frontend_default.conf