Skip to content

Commit ae05ea4

Browse files
committed
feat(proxy): Allow to configure changeOrigin option of http-proxy
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
1 parent ad94356 commit ae05ea4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/middleware/proxy.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ var parseProxyConfig = function (proxies, config) {
4444
(proxyDetails.protocol === 'https:' ? '443' : '80')
4545
var https = proxyDetails.protocol === 'https:'
4646

47+
var changeOrigin = 'changeOrigin' in proxyConfiguration ? proxyConfiguration.changeOrigin : false
4748
var proxy = httpProxy.createProxyServer({
4849
target: {
4950
host: hostname,
@@ -52,6 +53,7 @@ var parseProxyConfig = function (proxies, config) {
5253
protocol: protocol
5354
},
5455
xfwd: true,
56+
changeOrigin: changeOrigin,
5557
secure: config.proxyValidateSSL
5658
})
5759

0 commit comments

Comments
 (0)