2 years ago
Hi, I've been developing a product catalog for a client, and I recently finished it. In the first week, the website was working perfectly, but after two weeks, it stopped and started giving me CORS errors. I fixed the issue in the code, and it worked, but after another two weeks, the same error occurred again:
Access to XMLHttpRequest at 'https://example.up.railway.app/product' from origin 'https://[www.example.com](www.example.com).br' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Is this issue with my API, or is it a configuration problem in Railway?
Initially, my CORS policy only allowed requests from www.example.com. Later, I changed it to allow requests from any origin (*). Now, neither approach seems to work. What should I do?
11 Replies
2 years ago
cors is not likely the root issue here, the issue is most likely that you are being returned an error page that simply doesnt have cors headers
i've redeploy the website and now it's fine, the same page, the same product
2 years ago
please see my previous message
2 years ago
its you, please do not use nodemon in production
2 years ago
you should also be connecting to the database over the private network
