From 99f757251b42aeb5d26535a7363c96804ee057f0 Mon Sep 17 00:00:00 2001 From: Alexander Date: Wed, 26 Feb 2014 15:12:38 +0200 Subject: [PATCH] Fix for #591 Fix for proxy crash if `HOST` header is not defined bug https://github.com/nodejitsu/node-http-proxy/issues/591. --- 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 7897578..0646194 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' ;