diff --git a/lib/node-http-proxy.js b/lib/node-http-proxy.js index ccbd80b..561dad0 100644 --- a/lib/node-http-proxy.js +++ b/lib/node-http-proxy.js @@ -103,11 +103,11 @@ exports.createServer = function () { proxy = new HttpProxy(options); handler = callback ? function (req, res) { callback(req, res, proxy) } - : proxy.proxyRequest; + : function (req, res) { proxy.proxyRequest(req, res) }; server = options.https - ? https.createServer(options.https, handler.bind(proxy)) - : http.createServer(handler.bind(proxy)); + ? https.createServer(options.https, handler) + : http.createServer(handler); //server.on('close', function () { // proxy.close();