2

I have websites on a lot of servers. But on every server, I use one website to cross domain requests with ajax. In php file, where is allowed acces I have this:

header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, OPTIONS');
header('Access-Control-Max-Age: 1000');
header('Access-Control-Allow-Headers: Content-Type, Authorization, X-Requested-With');

In Javascript I have something like this:

$.getJSON('http://example.com/request.php?check=' + request, function(data) {
...

On servers, it works fine, but when I am on localhost, I get this in my console:

XMLHttpRequest cannot load [request]. A wildcard '*' cannot be used in the 
'Access-Control-Allow-Origin' header when the credentials flag is true. 
Origin 'http://localhost:8102' is therefore not allowed access.
debute
  • 2,638
  • 6
  • 30
  • 55

0 Answers0