Skip to content

Commit

Permalink
Do not shadow Host header when proxying
Browse files Browse the repository at this point in the history
Enable usage of Proxrox with hosts and configurations such as Heroku
which dispatch based on the `Host` header.
  • Loading branch information
bripkens committed Jan 17, 2016
1 parent 80fa723 commit a3081ef
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 1.12.0
- Enable usage of Proxrox with Heroku and many other hosters which dispatch based on the `Host` header.

## 1.11.0
- All dependencies have been updated to their latest version.

Expand Down
2 changes: 0 additions & 2 deletions lib/config_template.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,12 @@ http {
location @proxy {
proxy_pass <%- proxy['/'] %>;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
<% } Object.keys(proxy).filter(function(url) { return url !== '/' || root === false; }).forEach(function(url) { %>
location <%- url %> {
proxy_pass <%- proxy[url] %>;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
<% }); Object.keys(websocketProxy).forEach(function(url) { %>
Expand Down
2 changes: 0 additions & 2 deletions test/expectedConfigs/proxies.conf
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,12 @@ http {
location @proxy {
proxy_pass http://127.0.0.1:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

location /api {
proxy_pass http://api.example.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,18 @@ http {
location / {
proxy_pass http://127.0.0.1:3000;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

location /cms {
proxy_pass http://127.0.0.1:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

location /api {
proxy_pass http://api.example.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

Expand Down
2 changes: 0 additions & 2 deletions test/expectedConfigs/proxies_without_try_files.conf
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,12 @@ http {
location /cms {
proxy_pass http://127.0.0.1:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

location /api {
proxy_pass http://api.example.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

Expand Down
1 change: 0 additions & 1 deletion test/expectedConfigs/proxy.conf
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ http {
location @proxy {
proxy_pass http://127.0.0.1:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

Expand Down

0 comments on commit a3081ef

Please sign in to comment.