Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin'
theahmadjalalTRIAL
6 months ago
I am getting this error:
Access to XMLHttpRequest at 'https://emsserver-production-d7a6.up.railway.app/api/v1/auth/login' from origin 'https://test.saving-central.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Although I have set the cors policy in my server.js:
app.use(
cors({
origin: "https://test.saving-central.com",
credentials: true,
methods: ["POST", "GET", "PUT", "DELETE"],
})
);
Previously the same code works but now its causing issue, I have deleted service and created a new one as well but didn't work for me.
0 Replies