Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

disable cors policy symfony

//his code in the file public/index.php work perfectly.

header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Headers: X-API-KEY, Origin, X-Requested-With, Content-Type, Accept, Access-Control-Request-Method");
header("Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE");
header("Allow: GET, POST, OPTIONS, PUT, DELETE");
$method = $_SERVER['REQUEST_METHOD'];
if ($method == "OPTIONS") {
    die();
}

https://stackoverflow.com/a/60642286/7610978
 
PREVIOUS NEXT
Tagged: #disable #cors #policy #symfony
ADD COMMENT
Topic
Name
5+5 =