CORS policy error RUBY API
byhtada
TRIALOP

2 years ago

Hello
I deployed the server yesterday and everything was fine. And today the error started to appear:

I didn't change anything. The warm-up and restart do not help. I transferred another project to you and it's the same there.

What to do?

7 Replies

brody
EMPLOYEE

2 years ago

what status code are you getting back from the railway provided domain when you make a call to it?


byhtada
TRIALOP

2 years ago

Hello, Brody
Thanks for the quick response. This is what the browser console is written

Access to fetch at 'https://roapi2-production.up.railway.app/createuser' from origin 'https://byhtada.github.io' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. POST https://roapi2-production.up.railway.app/createuser net::ERR_FAILED

There is no error code


byhtada
TRIALOP

2 years ago

The railway logs do not write anything at the same time.


brody
EMPLOYEE

2 years ago

There is an error code, I got 503 from visiting that link, for this issue, please read this docs page -

https://docs.railway.app/guides/fixing-common-errors


byhtada
TRIALOP

2 years ago

I can't find the PORT variable, please help

Attachments


byhtada
TRIALOP

2 years ago

Although maybe we misunderstood each other. My front-end is located on github (still in development). And here is the backend on the railway. And when I turn to the back from the front, then CORS arises https://byhtada.github.io/ro_web2/


brody
EMPLOYEE

2 years ago

please carefully read the docs page i linked.


Loading...