Skip to content

Commit 546d251

Browse files
authored
Merge pull request #11 from Intellection/pass_through_x_forwarded_host
Pass through X-Forwarded-Host if set
2 parents ca36161 + fa1ab52 commit 546d251

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 1.19.5-8
4+
5+
* Allow passing through `X-Forwarded-Host` header if it's set.
6+
37
## 1.19.5-7
48

59
* Set `daemon` to `off`.

config/http.conf

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ http {
2121
port_in_redirect off;
2222
server_tokens off;
2323

24+
# If we receive X-Forwarded-Host, pass it through; otherwise, pass along the
25+
# host used to connect to this server
26+
map $http_x_forwarded_host $proxy_x_forwarded_host {
27+
default $http_x_forwarded_host;
28+
'' $host;
29+
}
30+
2431
# If we receive X-Forwarded-Proto, pass it through; otherwise, pass along the
2532
# scheme used to connect to this server
2633
map $http_x_forwarded_proto $proxy_x_forwarded_proto {
@@ -69,7 +76,7 @@ http {
6976
proxy_set_header X-Forwarded-Ssl $proxy_x_forwarded_ssl;
7077
proxy_set_header X-Forwarded-Port $proxy_x_forwarded_port;
7178
proxy_set_header X-Request-ID $proxy_x_request_id;
72-
proxy_set_header X-Forwarded-Host $host;
79+
proxy_set_header X-Forwarded-Host $proxy_x_forwarded_host;
7380

7481
include /etc/nginx/app.conf;
7582

0 commit comments

Comments
 (0)