When we try to access the media manager in our joomla site we get a blank file explorer and get this error in the console.
Access to XMLHttpRequest at 'https://www.example.com/administrator/index.php?option=com_media&format=json&mediatypes=0,1,2,3&task=api.files&path=local-images%3A%2F' from origin 'https://example.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.
To remedy this, we found a solution with which we had to update the headers of the index page.
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, PATCH, PUT, DELETE, OPTIONS');
header('Access-Control-Allow-Headers: Origin, Content-Type, X-Auth-Token');
header("HTTP/1.1 200 OK ");
However, we are still getting the same error.
Firstname is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.