Answer the question
In order to leave comments, you need to log in
Why can't I add Access-Control-Allow-Origin headers?
There are two sites, the second one should get the content from the first one using json.
The page of the second site gave an error:
XMLHttpRequest cannot load https:// address of the first site. Request header field Content-Type is not allowed by Access-Control-Allow-Headers.
Header set Access-Control-Allow-Origin "second site address"
Header set Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept"
Answer the question
In order to leave comments, you need to log in
Do you add like this?
header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept");
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question