V
V
Vyacheslav Ptsarev2015-10-26 17:27:51
JavaScript
Vyacheslav Ptsarev, 2015-10-26 17:27:51

How to fix Cross-Origin Request Blocked for Yandex Metrica?

After switching from http to https, I saw an error on the site in the Firefox console

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://mc.yandex.ru/webvisor/... (Reason: CORS request failed).

I am using nginx. In it he wrote:
add_header 'Access-Control-Allow-Origin' 'https://mc.yandex.ru';
add_header 'Access-Control-Allow-Methods' "POST, GET, OPTIONS, DELETE, PUT";
add_header 'Access-Control-Allow-Headers' "*";
add_header 'Access-Control-Allow-Credentials' 'true';

Did not help. What to do?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Guz, 2015-10-27
@aguz

You definitely do not need this config: you do not need to allow the browser from the mc.yandex.ru domain to read the content of your site.
Here we are talking about the fact that mc.yandex.ru would have to allow requests from your domain. but something went wrong..
- Try clearing your browser cache
- Recheck the domain in Yandex.Metrica settings for your site

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question