Answers for "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://us-central1-suffer-99f67.cloudfunctions.net/api/allusers. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing) angular"

0

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://vtl-lab.com/VN/crecc-cms/api/member/register.json. (Reason: CORS request did not succeed).

Add below code when request API

header("Access-Control-Allow-Origin: *");
Posted by: Guest on September-30-2020
0

Access to XMLHttpRequest at 'http://localhost/MySQL_pracs/InsertUser.php' from origin 'http://localhost:4200' has been blocked by CORS policy: Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response.

//Access to XMLHttpRequest at 'http://localhost/[api path].php' from origin 'http://localhost:4200' has been blocked by CORS policy: Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response.

//The error is simply saying that "Content-Type" is missing from "Access-Control-Allow-Headers".

//Therefore we need to add "Content-Type" to "Access-Control-Allow-Headers".

<?php 
header('Access-Control-Allow-Headers: Content-Type');
-----
?>
Posted by: Guest on October-10-2020

Code answers related to "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://us-central1-suffer-99f67.cloudfunctions.net/api/allusers. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing) angular"

Browse Popular Code Answers by Language