From 6a2803b7c18a161d4b69a0340c5fb3201aac5a78 Mon Sep 17 00:00:00 2001 From: Nate <nate.wang@sap.com> Date: Mon, 31 Aug 2015 18:30:27 +0800 Subject: [PATCH] Correctly parse url for https if port is not 443. --- lib/requestHandler.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/requestHandler.js b/lib/requestHandler.js index 482d737..4940782 100644 --- a/lib/requestHandler.js +++ b/lib/requestHandler.js @@ -20,9 +20,10 @@ var defaultRule = require("./rule_default.js"), function userRequestHandler(req,userRes){ var host = req.headers.host, - urlPattern = url.parse(req.url), - path = urlPattern.path, protocol = (!!req.connection.encrypted && !/^http:/.test(req.url)) ? "https" : "http", + fullUrl = protocol + '://' + host + req.url, + urlPattern = url.parse(fullUrl), + path = urlPattern.path, resourceInfo, resourceInfoId = -1, reqData;