- Install http-proxy-middleware
npm install http-proxy-middleware --save-dev or yarn add http-proxy-middleware --dev
- Create a file setupProxy.js in the /src folder
const { createProxyMiddleware, fixRequestBody } = require("http-proxy-middleware");
module.exports = app => {
app.use(createProxyMiddleware('**', {
target: 'https://...com',
changeOrigin: true,
secure: false,
onProxyReq: fixRequestBody,
}));
}
- Remove proxy and secure in the package.json (if any)
"proxy": "https://...com",
"secure": false
- Run
npm/yarn start.