Skip to content

Commit b8c6397

Browse files
committed
[fix] pass proper options object that extend the global options and parse the per proxy args into options. fixes #510
1 parent dda6f7a commit b8c6397

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

lib/http-proxy/index.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ var httpProxy = exports,
66
https = require('https'),
77
web = require('./passes/web-incoming'),
88
ws = require('./passes/ws-incoming');
9-
9+
1010
httpProxy.Server = ProxyServer;
1111

1212
/**
@@ -33,7 +33,7 @@ function createRightProxy(type) {
3333
cntr = args.length - 1,
3434
head, cbl;
3535

36-
/* optional args parse begin */
36+
/* optional args parse begin */
3737
if(typeof args[cntr] === 'function') {
3838
cbl = args[cntr];
3939

@@ -64,7 +64,7 @@ function createRightProxy(type) {
6464
});
6565

6666

67-
for(var i=0; i < passes.length; i++) {
67+
for(var i=0; i < passes.length; i++) {
6868
/**
6969
* Call of passes functions
7070
* pass(req, res, options, head)
@@ -73,7 +73,7 @@ function createRightProxy(type) {
7373
* refer to the connection socket
7474
* pass(req, socket, options, head)
7575
*/
76-
if(passes[i](req, res, this.options, head, cbl ? false : this, cbl)) { // passes can return a truthy value to halt the loop
76+
if(passes[i](req, res, options, head, cbl ? false : this, cbl)) { // passes can return a truthy value to halt the loop
7777
break;
7878
}
7979
}
@@ -103,9 +103,9 @@ require('util').inherits(ProxyServer, EE3);
103103
ProxyServer.prototype.listen = function(port) {
104104
var self = this,
105105
closure = function(req, res) { self.web(req, res); };
106-
107-
this._server = this.options.ssl ?
108-
https.createServer(this.options.ssl, closure) :
106+
107+
this._server = this.options.ssl ?
108+
https.createServer(this.options.ssl, closure) :
109109
http.createServer(closure);
110110

111111
if(this.options.ws) {
@@ -119,7 +119,7 @@ ProxyServer.prototype.listen = function(port) {
119119

120120
ProxyServer.prototype.before = function(passName, callback) {
121121
var i = false;
122-
this.passes.forEach(function(v, idx) {
122+
this.passes.forEach(function(v, idx) {
123123
if(v.name === passName) i = idx;
124124
})
125125

@@ -129,7 +129,7 @@ ProxyServer.prototype.before = function(passName, callback) {
129129
};
130130
ProxyServer.prototype.after = function(passName, callback) {
131131
var i = false;
132-
this.passes.forEach(function(v, idx) {
132+
this.passes.forEach(function(v, idx) {
133133
if(v.name === passName) i = idx;
134134
})
135135

0 commit comments

Comments
 (0)