diff --git a/lib/http-proxy/index.js b/lib/http-proxy/index.js index 4faa3956b..7528f46e6 100644 --- a/lib/http-proxy/index.js +++ b/lib/http-proxy/index.js @@ -101,10 +101,11 @@ function ProxyServer(options) { ProxyServer.prototype.listen = function(port) { var self = this, - closure = function(req, res) { self.web(req, res); }, - this._server = options.ssl ? - https.createServer(this.options.ssl, closure) : - http.createServer(closure); + closure = function(req, res) { self.web(req, res); }; + + this._server = options.ssl ? + https.createServer(this.options.ssl, closure) : + http.createServer(closure); if(options.ws) { this._server.on('upgrade', function(req, socket, head) { self.ws(req, socket, head); });