Deploy: 2026-05-21 01:58:32

This commit is contained in:
Hamza-Ayed
2026-05-21 01:58:32 +03:00
parent 16d494b4e1
commit aae860486a
11 changed files with 263 additions and 38 deletions

View File

@@ -39,10 +39,12 @@ class Response
$this->setStatusCode($code);
$this->setHeader('Content-Type', 'application/json; charset=utf-8');
// Setup base CORS headers for our API
$this->setHeader('Access-Control-Allow-Origin', '*');
// Setup CORS headers — restrict origin to the configured allowed domain
$allowedOrigin = getenv('ALLOWED_ORIGIN') ?: '*';
$this->setHeader('Access-Control-Allow-Origin', $allowedOrigin);
$this->setHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS');
$this->setHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization, X-Requested-With');
$this->setHeader('Vary', 'Origin'); // Required when Access-Control-Allow-Origin is not *
$this->sendHeaders();
http_response_code($this->statusCode);