Files
api/services/nginx/app/routes/optionsRoute.php
T

24 lines
556 B
PHP

<?php
namespace routes;
use traits\route_t;
require_once dirname(__DIR__) . '/classes/cors_policy.php';
class optionsRoute
{
use route_t;
public function run(): void
{
$this->options('/.*', function () {
global $CORS;
$preflight = \classes\cors_policy::preflightResponse($_SERVER['HTTP_ORIGIN'] ?? '', (string)($CORS ?? ''));
\classes\cors_policy::emitHeaders($preflight['headers']);
http_response_code($preflight['status']);
echo $preflight['body'];
});
}
}