E
E
Egor Sh2016-04-26 15:28:37
Nginx
Egor Sh, 2016-04-26 15:28:37

Problem with CORS Angular2 golang server and nginx, what did you do wrong?

Good afternoon! I can not get my site to send requests to the go server in any way.
The browser displays

XMLHttpRequest cannot load http://site.ru/v1/login. Origin http://site.ru is not allowed by Access-Control-Allow-Origin.

But in the golang server, I definitely allowed it, even the logs come
Preflight response headers: map[Vary:[Origin Access-Control-Request-Method Access-Control-Request-Headers] Access-Control-Allow-Origin:[http://site.ru] Access-Control-Allow-Methods:[POST] Access-Control-Allow-Headers:[Origin, Content-Type] Access-Control-Allow-Credentials:[true]]

as well as a reverse proxy, I use nginx, I also allowed it in it.
add_header Access-Control-Allow-Origin *;
And I don’t know what else can be done, I will be glad for any help, thanks!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Egor Sh, 2016-04-27
. @EgorkZe

If anything, the cant was that I added
the add_header Access-Control-Allow-Origin * headers several times; and
add_header Access-Control-Allow-Origin mysite.com;
And so it is impossible, it is necessary that there be only one

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question