Universeorange.com/Docs/

R3m/framework Function reference cors

{cors()}

{cors()} — This method must be called before anything else happens.

header("HTTP/1.1 200 OK");
header("Access-Control-Allow-Origin: *");
if (isset($_SERVER['HTTP_ORIGIN'])) {
    header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
}
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') { 
    header('Access-Control-Allow-Credentials: true');
    header('Access-Control-Allow-Methods: GET, POST, PATCH, PUT, DELETE, OPTIONS');
    header('Access-Control-Allow-Headers: Origin, Content-Type, Authorization');
    header('Access-Control-Max-Age: 86400');    // cache for 1 day
    exit(0);
}
Last modified: 2021-06-07

© 2021 universeorange.com