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?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b2bce4-33e73.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b2bce4-33e73.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?