I have a PHP file that creates a JSON document.
I set the header as follows, but still getting an error.
header('Access-Control-Allow-Origin: *'); header('Content-Type: application/json');
Error message:
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://mysubdomain.mydomain.com' is therefore not allowed access.
I tried explicitly allowing mysubdomain.mydomain.com to use
header('Access-Control-Allow-Origin: https://mysubdomain.mydomain.com');
But I still get the error.
php cors
Luke
source share