CORS stops working exactly 1 week later
Anonymous
TRIALOP

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

Anonymous
TRIALOP

2 years ago

n/a


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


Anonymous
TRIALOP

2 years ago

i've redeploy the website and now it's fine, the same page, the same product


2 years ago

please see my previous message


Anonymous
TRIALOP

2 years ago

i see


Anonymous
TRIALOP

2 years ago

this is the error

1271141354633691100


Anonymous
TRIALOP

2 years ago

but it's an railway or my configs?


2 years ago

its you, please do not use nodemon in production


Anonymous
TRIALOP

2 years ago

ok


2 years ago

you should also be connecting to the database over the private network


Anonymous
TRIALOP

2 years ago

thanks


Loading...