Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Neto committed Oct 29, 2024
1 parent 23921bd commit a606fb1
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions objects/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2542,20 +2542,30 @@ function allowOrigin()
{
global $global;
cleanUpAccessControlHeader();

$HTTP_ORIGIN = empty($_SERVER['HTTP_ORIGIN']) ? @$_SERVER['HTTP_REFERER'] : $_SERVER['HTTP_ORIGIN'];
if (empty($HTTP_ORIGIN)) {
$server = parse_url($global['webSiteRootURL']);
header('Access-Control-Allow-Origin: ' . $server["scheme"] . '://imasdk.googleapis.com');
} else {
header("Access-Control-Allow-Origin: " . $HTTP_ORIGIN);
}

// Allow access from private networks, if needed
header('Access-Control-Allow-Private-Network: true');
header('Access-Control-Request-Private-Network: true');
//header("Access-Control-Allow-Credentials: true");
header("Access-Control-Allow-Methods: GET,HEAD,OPTIONS,POST,PUT");
header("Access-Control-Allow-Headers: Access-Control-Allow-Headers, Origin,Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers");

// Allow credentials (cookies, authorization headers, etc.) if needed
// Uncomment if required
// header("Access-Control-Allow-Credentials: true");

// Specify allowed methods
header("Access-Control-Allow-Methods: GET, HEAD, OPTIONS, POST, PUT");

// Specify allowed headers, including cache-control
header("Access-Control-Allow-Headers: Origin, Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers, cache-control");
}


function cleanUpAccessControlHeader()
{
if (!headers_sent()) {
Expand Down

0 comments on commit a606fb1

Please sign in to comment.