Update: 2026-06-29 00:07:33
This commit is contained in:
@@ -5,6 +5,21 @@
|
||||
// ============================================================
|
||||
|
||||
require_once __DIR__ . '/core/bootstrap.php';
|
||||
|
||||
// --------- تحقق من تطابق المنطقة (Region Mismatch Guard) ---------
|
||||
$requestHost = $_SERVER['HTTP_HOST'] ?? '';
|
||||
$appDomain = getenv('APP_DOMAIN') ?: '';
|
||||
if (!empty($appDomain) && !empty($requestHost) && strtolower($requestHost) !== strtolower($appDomain)) {
|
||||
if ($requestHost !== 'localhost' && !preg_match('/^127\.0\.0\./', $requestHost)) {
|
||||
http_response_code(400);
|
||||
exit(json_encode([
|
||||
'status' => 'failure',
|
||||
'error_code' => 'REGION_MISMATCH',
|
||||
'message' => "Region mismatch: Request host '$requestHost' does not match server domain '$appDomain'."
|
||||
]));
|
||||
}
|
||||
}
|
||||
|
||||
require_once __DIR__ . '/functions.php';
|
||||
|
||||
// 1. Rate Limiting and JWT Authentication
|
||||
|
||||
Reference in New Issue
Block a user