Answer the question
In order to leave comments, you need to log in
CORS. Sending a request with https. Why does not it work?
Greetings.
The problem is this:
when you try to send a request to the address: site.com , the browser immediately responds:
Заблокирована загрузка смешанного активного содержимого «http://site.com»
//site.com
Запрос из постороннего источника заблокирован: Политика одного источника запрещает чтение удаленного ресурса на https://www.site.com. Это может быть исправлено путем перемещения ресурса в тот же домен или включением CORS.
header('Access-Control-Request-Method: *');
header('Access-Control-Allow-Origin: ' . $_SERVER['HTTP_ORIGIN']);
header('Content-Type: Application/json');
Answer the question
In order to leave comments, you need to log in
The Access-Control-Allow-Origin
header should not be * in this case.
Example for PHP:
header('Access-Control-Allow-Origin: ' . $_SERVER['HTTP_ORIGIN']);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question