I am using http-proxy-middleware to proxy hosts in my React project.
Below is the code from setupProxy.js file:
const {createProxyMiddleware} = require('http-proxy-middleware');
module.exports = function(app) {
app.use('/api', createProxyMiddleware({ target: 'http://localhost:8080', changeOrigin: true, }));
app.use('/api/user/logout', createProxyMiddleware({ target: 'http://localhost:9091', changeOrigin: true, }))
};
As you can see I added two proxy codes. For the logout, I want to use a different host. /api is working fine, but the /api/user/logout is not working.
Thanks in advance.