File tree 1 file changed +19
-10
lines changed
1 file changed +19
-10
lines changed Original file line number Diff line number Diff line change @@ -183,16 +183,25 @@ ProxyTable.prototype.getProxyLocation = function (req) {
183
183
else if ( this . pathnameOnly === true ) {
184
184
var target = req . url ;
185
185
for ( var i in this . routes ) {
186
- var route = this . routes [ i ] ;
187
- if ( target . match ( route . source . regexp ) ) {
188
- req . url = url . format ( target . replace ( route . source . regexp , '' ) ) ;
189
- return {
190
- protocol : route . target . url . protocol . replace ( ':' , '' ) ,
191
- host : route . target . url . hostname ,
192
- port : route . target . url . port
193
- || ( this . target . https ? 443 : 80 )
194
- } ;
195
- }
186
+ var route = this . routes [ i ] ;
187
+ //
188
+ // If we are matching pathname only, we remove the matched pattern.
189
+ //
190
+ // IE /wiki/heartbeat
191
+ // is redirected to
192
+ // /heartbeat
193
+ //
194
+ // for the route "/wiki" : "127.0.0.1:8020"
195
+ //
196
+ if ( target . match ( route . source . regexp ) ) {
197
+ req . url = url . format ( target . replace ( route . source . regexp , '' ) ) ;
198
+ return {
199
+ protocol : route . target . url . protocol . replace ( ':' , '' ) ,
200
+ host : route . target . url . hostname ,
201
+ port : route . target . url . port
202
+ || ( this . target . https ? 443 : 80 )
203
+ } ;
204
+ }
196
205
}
197
206
198
207
}
You can’t perform that action at this time.
0 commit comments