From c7185424e9fff6c0e84b58a56b35acdbd1252852 Mon Sep 17 00:00:00 2001 From: Sean Fujiwara Date: Sun, 7 Dec 2014 15:19:17 -0800 Subject: [PATCH] Include port when using changeOrigin According to the HTTP spec, the port needs to be included in the host header if it's not the default port. It can be included even if it is the default port, so the easiest thing to do is always include it. --- lib/http-proxy/common.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/http-proxy/common.js b/lib/http-proxy/common.js index 24ed323c7..f7724b676 100644 --- a/lib/http-proxy/common.js +++ b/lib/http-proxy/common.js @@ -74,7 +74,7 @@ common.setupOutgoing = function(outgoing, options, req, forward) { outgoing.path = common.urlJoin(targetPath, outgoingPath); if (options.changeOrigin) { - outgoing.headers.host = outgoing.host; + outgoing.headers.host = outgoing.host + ':' + outgoing.port; } return outgoing;