R
Railway2y ago
Davo

Cors Problems

Hi I'm trying to host an express server and whenever I make requests from my front end I am getting cors problems. my backend has app.use(cors()) and I do not get these issues when running my backend locally (on a different port to my front end) I don't think the server is crashing as I can visit the pages in my browser and it works correctly any ideas?
6 Replies
Percy
Percy2y ago
Project ID: 5d764c6d-b14c-49e5-8e63-651e03809dfb
Percy
Percy2y ago
The problem was that the code was listening on 'port' instead of 'PORT'. The local variable was in lowercase in the .env file, which caused the issue.
⚠️ experimental feature
Davo
DavoOP2y ago
5d764c6d-b14c-49e5-8e63-651e03809dfb
Davo
DavoOP2y ago
I dont believe the issue that the experimental feature describes is the problem:
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Davo
DavoOP2y ago
That doesnt seem to work, thank you though. I believe its something to do with requests to my database failing - making the server think its a cors problem??
Want results from more Discord servers?
Add your server