8 months ago
My current application using React, MySQL and express is failing to get past the CORS error. I have setup the CORS in my server.js using...
But it seems like that method doesnt seem to be working. Github: https://github.com/ethancs13/dbdbdb
app.use(
cors({
origin: [process.env.CLIENT_ORIGIN],
methods: ["POST", "GET", "DELETE"],
credentials: true,
})
);
12 Replies
8 months ago
Cors is not the issue here.
Open your backend's domain in your browser and you will see that the application didn't respond.
Your domain is pointing to the wrong port.
8 months ago
how do i fix this?
8 months ago
where would I do this? In the frontend react or backend express server? what would I set the variables to?
8 months ago
ive tried changing it to both 3000 and 3001, the two ports I am using, and both result in the same error on the frontend, with the backend working fine
8 months ago
The server service uses the correct port now, but the frontend does not, please correct that as well.
8 months ago
The front and backend seem to be working, but again there seems to be a CORS issue?
8 months ago
app.use(
cors({
origin: [process.env.CLIENT_ORIGIN],
methods: ["POST", "GET", "DELETE"],
credentials: true,
})
);
8 months ago
is this not what is needed?