src/Common/HttpFunctions.php
public static function allowCors()
    {
        $origin = filter_input(INPUT_SERVER, 'HTTP_ORIGIN');
        $protocol = filter_input(INPUT_SERVER, 'REQUEST_SCHEME') ?? 'http';
        $host = preg_replace("/^http(s)?:\/{2}/", "", $origin);
        $allowedHosts = cfg::ALLOW_CORS;
        $allowedHosts[] = cfg::HOST_DEV;

        if (in_array($host, $allowedHosts)) {
            header("Access-Control-Allow-Origin: " . $protocol . "://" . $host);
        }
    }
public static function allowCors()
    {
        $origin = filter_input(INPUT_SERVER, 'HTTP_ORIGIN');
        $protocol = filter_input(INPUT_SERVER, 'REQUEST_SCHEME') ?? 'http';
        $host = preg_replace("/^http(s)?:\/{2}/", "", $origin);
        $allowedHosts = cfg::ALLOW_CORS;
        $allowedHosts[] = cfg::HOST_DEV;

        if (in_array($host, $allowedHosts)) {
            header("Access-Control-Allow-Origin: " . $protocol . "://" . $host);
        }
    }
public static function allowCors ( ) { $ origin = filter_input ( INPUT_SERVER , 'HTTP_ORIGIN' ) ; $ protocol = filter_input ( INPUT_SERVER , 'REQUEST_SCHEME' ) ?? 'http' ; $ host = preg_replace ( "/^http(s)?:\/{2}/" , "" , $ origin ) ; $ allowedHosts = cfg :: ALLOW_CORS ; $ allowedHosts [ ] = cfg :: HOST_DEV ; if ( in_array ( $ host , $ allowedHosts ) ) { header ( "Access-Control-Allow-Origin: " . $ protocol . "://" . $ host ) ; } }
Set header Access-Control-Allow-Origin to Allowed hosts
Set header Access - Control - Allow - Origin to Allowed hosts