Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[doc] added comments to pathnameOnly block.

  • Loading branch information...
commit 5e6be6ccf5a39ff450e57d7b24e374a83569fa85 1 parent a1607c1
@mikkel mikkel authored indexzero committed
Showing with 19 additions and 10 deletions.
  1. +19 −10 lib/node-http-proxy/proxy-table.js
View
29 lib/node-http-proxy/proxy-table.js
@@ -183,16 +183,25 @@ ProxyTable.prototype.getProxyLocation = function (req) {
else if (this.pathnameOnly === true) {
var target = req.url;
for (var i in this.routes) {
- var route = this.routes[i];
- if (target.match(route.source.regexp)) {
- req.url = url.format(target.replace(route.source.regexp, ''));
- return {
- protocol: route.target.url.protocol.replace(':', ''),
- host: route.target.url.hostname,
- port: route.target.url.port
- || (this.target.https ? 443 : 80)
- };
- }
+ var route = this.routes[i];
+ //
+ // If we are matching pathname only, we remove the matched pattern.
+ //
+ // IE /wiki/heartbeat
+ // is redirected to
+ // /heartbeat
+ //
+ // for the route "/wiki" : "127.0.0.1:8020"
+ //
+ if (target.match(route.source.regexp)) {
+ req.url = url.format(target.replace(route.source.regexp, ''));
+ return {
+ protocol: route.target.url.protocol.replace(':', ''),
+ host: route.target.url.hostname,
+ port: route.target.url.port
+ || (this.target.https ? 443 : 80)
+ };
+ }
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.