Answers for "symfony simple cors"

PHP
0

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
Posted by: Guest on April-13-2021

Browse Popular Code Answers by Language