I am facing a CORS (Cross-Origin Resource Sharing) issue in my MERN stack project after deploying my backend to a live server on Vercel.
Here’s my setup:
Frontend:
Framework: React.js
Deployed on: Vercel
Domain: https://tours-travel-nine.vercel.app/
Backend:
Framework: Node.js with Express
Deployed on: Vercel
Domain: https://tours-travel-backend-three.vercel.app/
Error i am facing that shown in that image
Configured cors Middleware in Express
Expected: The backend would include the Access-Control-Allow-Origin header in the response, allowing the frontend to access the API.
Result: Still got the CORS error in the browser console.
Tested Wildcard Origin for CORS
I allowed all origins temporarily for testing purposes.
Code for CORS i have write for CORS