Can I rewrite the request path with http-proxy-middleware

for example, I request localhost:8080/a/b/c.cd

proxy to http://www.aaaa.com/api/

can you change / a/b/c.cd to / a/b/c ,

before proxy?

means that the agent rewrites the original path

before.
Feb.26,2021

it should be possible to use rewrite https://blog.csdn.net/xmlovet.


app.use('/a/b/c.cd', proxy({
    target: 'http://www.aaaa.com',
    changeOrigin: true,
    pathRewrite: {
            '^/a/b/c.cd' : '/api/a/b/c',
        },
}));

like this?

Menu