public static function getCORSResponseHeaders()
    {
        $headers = [];
        if (isset($_SERVER['HTTP_ORIGIN'])) {
            $headers['Access-Control-Allow-Origin'] = $_SERVER['HTTP_ORIGIN'];
            $headers['Access-Control-Allow-Credentials'] = 'true';
            $headers['Access-Control-Max-Age'] = '86400';
        }

        if (static::isOptionsRequest()) {
            if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD'])) {
                $headers['Access-Control-Allow-Methods'] = 'GET, POST, OPTIONS';
            }

            if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS'])) {
                $headers['Access-Control-Allow-Headers'] = $_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS'];
            }
        }

        return $headers;
    }