S
S
speedvm2021-11-19 16:06:38
CORS
speedvm, 2021-11-19 16:06:38

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


Wherever I did not shove "Access-Control-Allow-Origin". Help what you can.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
speedvm, 2021-12-09
@speedvm

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>

Although, it may also be that I have included (out of hopelessness) almost all apache modules on the server.

A
Alexey Ukolov, 2021-11-19
@alexey-m-ukolov

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 question

Ask a Question

731 491 924 answers to any question