-
Notifications
You must be signed in to change notification settings - Fork 878
Closed
Labels
Description
Your rewrite library seems to be working well. It would be nice if your library supported rewriting proxy redirects. For instance, a proxy is configured like so:
autoRewrite: true,
pathRewrite: {
'^/newpath/' : '/'
}If the target server responds with 302, then the client will be redirected to a 404 page because /newpath/ is not appended to the location header. To workaround this, I have modified web-outgoing.js in node_modules/http-proxy to check if autoRewrite is a string. If it is a string, append it to the location. I'm sure there is a better way to do this....
autoRewrite: '/newpath',
pathRewrite: {
'^/newpath/' : '/'
} if (options.hostRewrite) {
u.host = options.hostRewrite;
} else if (options.autoRewrite) {
if(typeof options.autoRewrite === 'string')
u.host = req.headers['host'] + options.autoRewrite;
else
u.host = req.headers['host'];
}nielk, jrnail23, mauriciopoppe, adoyle-h, uber5001 and 2 more