CORS Preflight Issue #7450
Replies: 2 comments
-
Update: I deleted the original GitHub repository and made two new repositories for the app: one here for the server and the other here for the client. And then I also made two new Vercel projects, server and client, after deleting the ones from before that were linked to the older repository. Here's a link to the newly deployed app, a link to I still have the same error about preflight requests as before. The error appears in the console when you first navigate to the app and a request is made to the refresh token route on the backend. Could someone please review my configuration and code and tell me what I'm doing wrong or what I'm missing? It's a MERN stack app, and the React code is built using Vite. |
Beta Was this translation helpful? Give feedback.
-
This discussion was automatically locked because the community moved to a new site. Please join us at vercel.community |
Beta Was this translation helpful? Give feedback.
-
Summary
Hi,
I have a CORS preflight request issue that I need resolved.
My main Node.js server file is here on GitHub, and here's the
vercel.json
file.The full error messages I'm getting in the console are:
The file
server.js
includes the CORS configuration code, and I also put the same headers and methods invercel.json
. So, why is it stil saying that there's no "Access-Control-Alllow-Origin" header provided for the resource? What am I still missing? Someone please help me. Thanks.PS. I opened another issue before to report an error I was getting when trying to deploy my server code to Vercel, error code 128, but I resolved it on my own afterwards by changing the
use
key invercel.json
to "@vercel/node" instead of "vercel/node". I want to close the discussion thread now, but I can't find it.Example
No response
Steps to Reproduce
Visit https://personal-library-client.vercel.app and try to register. You should see the CORS preflight errors come up in the console. The preflight error on the JWT refresh token route will come first (or at least it does for me, before I try to login (I already have an account there since I've been testing it since before)).
I already linked to the files I think should be looked at. You may also try taking a look at the
Register.tsx
andLogin.tsx
files in the client directory.Beta Was this translation helpful? Give feedback.
All reactions