diff --git a/lib/node-http-proxy/http-proxy.js b/lib/node-http-proxy/http-proxy.js index b2530e51c..2818bf0ef 100644 --- a/lib/node-http-proxy/http-proxy.js +++ b/lib/node-http-proxy/http-proxy.js @@ -105,7 +105,6 @@ var HttpProxy = exports.HttpProxy = function (options) { this.source.https = this.source.https || options.https; this.emulateModProxy = options.emulateModProxy || false; this.changeOrigin = options.changeOrigin || this.emulateModProxy; - this.rewriteRedirects = options.rewriteRedirects || this.emulateModProxy; }; // Inherit from events.EventEmitter @@ -258,29 +257,6 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) { if (self.source.https && !self.target.https) { response.headers.location = response.headers.location.replace(/^http\:/, 'https:'); } - - if(self.rewriteRedirects) { - ['location', 'content-location', 'uri'].forEach(function(key){ - if(!response.headers.hasOwnProperty(key)) { - return; - } - var location = response.headers[key]; - - if (location.match(/^http[s]?\:/)) { - var srcPath = self.source.pathname || ''; - location = location.replace(self.target.host + ':' + self.target.port, self.source.host + ":" + self.source.port + srcPath); - } else if (self.source.pathname && self.source.pathname != '/') { - - if (location[0] != '/') { - location = '/' + location; - } - - location = self.source.pathname + location; - } - - response.headers[key] = location; - }); - } } // Set the headers of the client response diff --git a/lib/node-http-proxy/routing-proxy.js b/lib/node-http-proxy/routing-proxy.js index 9335e29be..4adaa32fc 100644 --- a/lib/node-http-proxy/routing-proxy.js +++ b/lib/node-http-proxy/routing-proxy.js @@ -53,7 +53,6 @@ var RoutingProxy = exports.RoutingProxy = function (options) { this.forward = options.forward; this.emulateModProxy = options.emulateModProxy || false; this.changeOrigin = options.changeOrigin || this.emulateModProxy; - this.rewriteRedirects = options.rewriteRedirects || this.emulateModProxy; // // Listen for 'newListener' events so that we can bind 'proxyError' @@ -98,7 +97,7 @@ RoutingProxy.prototype.add = function (options) { // Setup options to pass-thru to the new `HttpProxy` instance // for the specified `options.host` and `options.port` pair. // - ['https', 'enable', 'forward', 'emulateModProxy', 'changeOrigin', 'rewriteRedirects'].forEach(function (key) { + ['https', 'enable', 'forward', 'emulateModProxy', 'changeOrigin'].forEach(function (key) { if (options[key] !== false && self[key]) { options[key] = self[key]; }