@Vinyl-Davyl
Software Engineer | --- .--. . -. / ... --- ..- .-. -.-. .
Software Engineering! knife talk only🧘
JavaScript, Typescript, Golang, Solidity, React.js, Vue.js, Node.js and the web!
Come and explore this world of the software development Industry with me!
GIG / HIRE
Okay, Hi DragonOsman, I understand the frustration you're facing with the CORS issue in your MERN app deployed on Vercel. It's great that you've taken steps to set up CORS and proxy settings to allow communication between your frontend and backend. Sorry for replying this late. But I would try and help as much as I can. First, make sure that your CORS configuration is correct in both your server and client code. It seems like you've defined the CLIENT_URL and added it to the origin field in your app.use(cors(...)) middleware, which is correct. Yeah, but However, the issue might lie in how the headers are being set and how preflight requests are being handled. I suggest to resolve this issue you check your Server Headers: Make sure that your server is actually sending the Access-Control-Allow-Origin header with the correct value ( CLIENT_URL ). It should be sent as a response header when the server receives an OPTIONS request. Also Check the Handle Preflight Requests: The app.options("*", cors()); line is correct, and it should come before the app.use(cors({...})) middleware. This handles preflight requests, which are used to check the server's CORS policy before making the actual request. Ensure that this setup is in place. Check, CORS Configuration too Osman. Verify that there are no typos or syntax errors in your CORS configuration. Double-check the URLs and ensure they match your frontend and backend URLs. And even the deployed ones. If you have them deployed on vercel already. Check your Vercel Configurations and Network Tab Debugging: Check if Vercel has any specific CORS settings that you need to configure. Some hosting platforms have their own CORS configurations that can affect your app. Use your browser's developer tools to inspect the network requests. Check the request and response headers to ensure that the expected CORS headers are present. This might help, Remember, CORS issues can be tricky, but with careful debugging and attention to detail, you'll likely find a solution. Best of luck, and I hope your app's functionality will be up and running smoothly soon! 🚀 cheers.