From a3081ef7ec652dc858fb5c0c3215cb77bd95b5a1 Mon Sep 17 00:00:00 2001 From: Ben Ripkens Date: Sun, 17 Jan 2016 13:25:37 +0100 Subject: [PATCH] Do not shadow Host header when proxying Enable usage of Proxrox with hosts and configurations such as Heroku which dispatch based on the `Host` header. --- CHANGELOG.md | 3 +++ lib/config_template.ejs | 2 -- test/expectedConfigs/proxies.conf | 2 -- test/expectedConfigs/proxies_without_static_asset_serving.conf | 3 --- test/expectedConfigs/proxies_without_try_files.conf | 2 -- test/expectedConfigs/proxy.conf | 1 - 6 files changed, 3 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 607d355..80ad2bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/lib/config_template.ejs b/lib/config_template.ejs index b76cbb6..7474d3f 100644 --- a/lib/config_template.ejs +++ b/lib/config_template.ejs @@ -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) { %> diff --git a/test/expectedConfigs/proxies.conf b/test/expectedConfigs/proxies.conf index 0d7965a..e3d9375 100644 --- a/test/expectedConfigs/proxies.conf +++ b/test/expectedConfigs/proxies.conf @@ -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; } diff --git a/test/expectedConfigs/proxies_without_static_asset_serving.conf b/test/expectedConfigs/proxies_without_static_asset_serving.conf index 6a76716..d6366e6 100644 --- a/test/expectedConfigs/proxies_without_static_asset_serving.conf +++ b/test/expectedConfigs/proxies_without_static_asset_serving.conf @@ -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; } diff --git a/test/expectedConfigs/proxies_without_try_files.conf b/test/expectedConfigs/proxies_without_try_files.conf index a143894..78bca10 100644 --- a/test/expectedConfigs/proxies_without_try_files.conf +++ b/test/expectedConfigs/proxies_without_try_files.conf @@ -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; } diff --git a/test/expectedConfigs/proxy.conf b/test/expectedConfigs/proxy.conf index 70203c0..f3753e9 100644 --- a/test/expectedConfigs/proxy.conf +++ b/test/expectedConfigs/proxy.conf @@ -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; }