We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2061c71 commit c03a450Copy full SHA for c03a450
lib/node-http-proxy/proxy-table.js
@@ -138,14 +138,12 @@ ProxyTable.prototype.getProxyLocation = function (req) {
138
var route = this.routes[i];
139
if (target.match(route.route)) {
140
141
- var segments = route.path.split('/');
+ var pathSegments = route.path.split('/');
142
143
- if (segments.length > 0) {
144
- var lastSegment = new RegExp("/" + segments[segments.length - 1] + "$");
145
-
146
- if(req.url.match(lastSegment)) {
147
- req.url = req.url.replace(lastSegment, '/');
148
- }
+ if (pathSegments.length > 0) {
+ // don't include the proxytable path segments in the proxied request url
+ pathSegments = new RegExp("/" + pathSegments.slice(1).join('/'));
+ req.url = req.url.replace(pathSegments, '');
149
}
150
151
var location = route.target.split(':'),
0 commit comments