Browse Source

roles/reverse_proxy: fix http redirect with multiple server_names

When using multiples server names in `server_name`, the NGINX variable
`$server_name` will always point only to the first entry. `$host`
variable, instead, point to the selected host from the user (HTTP
request or Host: header).
python3
Zolfa 5 years ago
parent
commit
23e801529d
Signed by: zolfa GPG Key ID: E1A43B038C4D6616
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      roles/reverse_proxy/templates/http.conf.j2

+ 2
- 2
roles/reverse_proxy/templates/http.conf.j2 View File

@ -15,8 +15,8 @@ server {
# Redirect to HTTPS all non-ACME requests
location / {
if ($request_method = POST) {
return 307 https://$server_name$request_uri;
return 307 https://$host$request_uri;
}
return 301 https://$server_name$request_uri;
return 301 https://$host$request_uri;
}
}

Loading…
Cancel
Save