Reputation: 41
Hi I been trying the proxy solution to avoid the cors problems in myapp but it doesn't seem to work, i restarted my machine so many times and that made no difference. Basically myapp using fetchApi to call another domain (localhost:8080) which is a SpringBoot application endpoint. I added in package.json "proxy": "http://localhost:8080/" but the api still return calls with localhost:3000 and i tried setupProxy.js but i faced same issue....Am i missing anything else ! any help would be appreciated...
const { createProxyMiddleware } = require("http-proxy-middleware");
module.exports = function (app) {
app.use(
"/oauth",
createProxyMiddleware({
target: "http://localhost:8080",
changeOrigin: true,
secure: false,
logLevel: "debug",
})
);
};
Upvotes: 3
Views: 1440
Reputation: 11
I removed the {}
on createProxyMiddleware
and it started working.
Thanks
Upvotes: 1