CORS: header("Access-Control-Allow-Origin: *") not working
-
This coding could also be set in a plugin. I did it in functions.php
first line after <?php:
header(“Access-Control-Allow-Origin: *”);Is not working. In Chrome console the following error is reported:
XMLHttpRequest cannot load https://[Domain_A]/wp-admin/admin-ajax.php. No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘https://[Domain_B]’ is therefore not allowed access. The response had HTTP status code 401.I don’t understand that, for I set the header, and therefor a ‘Access-Control-Allow-Origin’ header has to be present with wildcard, so it should work from all origins!
Any ideas?
Tom
- The topic ‘CORS: header("Access-Control-Allow-Origin: *") not working’ is closed to new replies.