diff --git a/lib/http-proxy/common.js b/lib/http-proxy/common.js index 7897578805be3357183c5a1ee1d9baf1ddaa9829..0646194dedc97a382648226527dc226f456b28c1 100644 --- a/lib/http-proxy/common.js +++ b/lib/http-proxy/common.js @@ -75,7 +75,7 @@ common.setupSocket = function(socket) { }; common.getPort = function(req) { - var res = req.headers.host.match(/:(\d+)/); + var res = req.headers.host ? req.headers.host.match(/:(\d+)/) : ""; return res ? res[1] : req.connection.pair ? '443' : '80' ;