Skip to content

Commit

Permalink
feat(proxy): Allow to configure changeOrigin option of http-proxy
Browse files Browse the repository at this point in the history
http-proxy has an option 'changeOrigin' (disabled by default) to rewrite
 the Host header in proxified requests wih the host from the target
 configuration.

Closes #1729
  • Loading branch information
Volune committed Dec 2, 2015
1 parent ad94356 commit ae05ea4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/middleware/proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ var parseProxyConfig = function (proxies, config) {
(proxyDetails.protocol === 'https:' ? '443' : '80')
var https = proxyDetails.protocol === 'https:'

var changeOrigin = 'changeOrigin' in proxyConfiguration ? proxyConfiguration.changeOrigin : false
var proxy = httpProxy.createProxyServer({
target: {
host: hostname,
Expand All @@ -52,6 +53,7 @@ var parseProxyConfig = function (proxies, config) {
protocol: protocol
},
xfwd: true,
changeOrigin: changeOrigin,
secure: config.proxyValidateSSL
})

Expand Down

0 comments on commit ae05ea4

Please sign in to comment.