So I'm building a react webapp that calls some methods deployed on a server.
I installed http-proxy-middleware and added the follow under src folder: setupProxy.js
const { createProxyMiddleware } = require('http-proxy-middleware');
module.exports = function (app) {
app.use(
'/api',
createProxyMiddleware({
target: process.env.API_URL,
changeOrigin: true,
pathRewrite: { '^/api': '' }
})
);
};
However, things seem to be working fine locally but when I deploy, the APIs seem to return the html page. Moreover, if I add a <noscript>
tag, I get the noscript value within the API preview.
I tried few solutions online but it seems I can't really detect what I'm missing.
Any help would be appreicated