From 45433d6e0c2483b1979e76f4e4bc0f76805bbced Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8A=A0=E9=87=8C?= Date: Thu, 11 Sep 2014 14:17:48 +0800 Subject: [PATCH] fix https issue --- lib/requestHandler.js | 6 ++++++ package.json | 2 +- proxy.js | 1 - 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/requestHandler.js b/lib/requestHandler.js index 4daa2cd..4f89f26 100644 --- a/lib/requestHandler.js +++ b/lib/requestHandler.js @@ -16,6 +16,7 @@ var httpsServerMgrInstance = new httpsServerMgr(), userRule = defaultRule; //init function userRequestHandler(req,userRes){ + var host = req.headers.host, urlPattern = url.parse(req.url), path = urlPattern.path, @@ -220,6 +221,11 @@ function connectReqHandler(req, socket, head){ var shouldIntercept = userRule.shouldInterceptHttpsReq(req); + //bypass webSocket on webinterface + if(targetPort == 8003){ + shouldIntercept = false; // TODO : a more general solution? + } + console.log(color.green("\nreceived https CONNECT request " + host)); if(shouldIntercept){ console.log("==>will forward to local https server"); diff --git a/package.json b/package.json index c63fd37..f1ab57f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "anyproxy", - "version": "2.3.3", + "version": "2.3.4", "description": "a charles/fiddler like proxy written in NodeJs, which can handle HTTPS requests and CROS perfectly.", "main": "proxy.js", "bin": { diff --git a/proxy.js b/proxy.js index a98e837..41f4d8a 100644 --- a/proxy.js +++ b/proxy.js @@ -211,7 +211,6 @@ function UIConfigServer(port){ inherits(UIConfigServer, events.EventEmitter); - function proxyWebServer(port){ var self = this;