I have configured my setupProxy.js for my node/react application like this :
const { createProxyMiddleware } = require('http-proxy-middleware');
module.exports = function(app) {
app.use(
'/media',
createProxyMiddleware({
target: 'http://172.20.128.2:8000/media',
changeOrigin: true,
})
);
app.use(
'/api',
createProxyMiddleware({
target: 'http://172.20.128.2:8000/api',
changeOrigin: true,
})
);
};
However, my api call to /api/blog/posts/?limit=2&offset=0&category=&tag=&format=json goes to http://localhost:3000/api/blog/posts/?limit=2&offset=0&category=&tag=&format=json.
the /api is not substituted by the target i have put in my setupProxy.js file.
When i run yarn start in my docker container, i do have :
nginx_cont_1 | [HPM] Proxy created: / -> http://172.20.128.2:8000/media
nginx_cont_1 | [HPM] Proxy created: / -> http://172.20.128.2:8000/api
So the proxy is created.
Should i put /api* or something like that in my setupProxy.js file to have the proxy work?