I’m sending a POST request to my backend with axios and withCredentials set to true, an error occurs:
Response to preflight request doesn’t pass access control check: The value of the ‘Access-Control-Allow-Origin’ header in the response must not be the wildcard ‘*’ when the request’s credentials mode is ‘include’.
server.ts
cors({
origin: "https://up-meet.vercel.app/",
methods: "GET,HEAD,PUT,PATCH,POST,DELETE",
credentials: true, })`
);
vite.config.ts
define: {
"process.env.API_KEY": JSON.stringify(process.env.API_KEY),
},
server: {
proxy: {
"/api": {
target: "https://upmeet.onrender.com",
},
},
},
});
I tried to remove the withCredentials from the axios request which worked, but of course, the cookies are not stored in the browser which is not what I want.