How do I resolve CORS issue?
I've been trying to create a new item through Angular and used PHP as my backend, but I kept receiving an error saying, "Access to XMLHttpRequest at 'http://localhost/api/product/create.php' from origin 'http://localhost:4200' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status." These are the headers: header("Access-Control-Allow-Origin: *"); header("Content-Type: application/json; charset=UTF-8") header("Access-Control-Allow-Methods: POST") header("Access-Control-Allow-Age: 3600") header("Access-Control-Allow-Headers: Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With); It works as expected when I tested it on Postman. The solutions I find online doesn't work for me. How do I resolve this issue?