Answer the question
In order to leave comments, you need to log in
And again the problem with CORS, am I tempted to dig?
Good day to all!
Do not kick with your feet, I know that it has been discussed 100500 times, but I have been sitting for the second day.
Nginx is a proxy server.
Requests to domain.com are proxied to 10.0.0.11. (this is a front)
Requests to the app.domain.com domain are proxied to 10.0.0.12. (and this is a type of back)
Transferred the back (10.0.0.12) to a new server, with the environment, everything is as it should be.
As a result, on the main page of domain.com in the developer panel I see:
Access to XMLHttpRequest at 'https://app.domain.com/api/v1/tests/user/results/' from origin 'https://domain.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.
GET https://app.domain.com/api/v1/tests/user/results/ net::ERR_FAILED
Answer the question
In order to leave comments, you need to log in
He perverted as best he could.
In the end (most likely) this helped in .htaccess at the root of the site:
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS"
Header set Access-Control-Allow-Headers "*"
</IfModule>
You need to shove it into the nginx proxy config into the app.domain.com server block.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question