Actualiser api/auth.php
This commit is contained in:
+7
-3
@@ -1,14 +1,18 @@
|
||||
<?php
|
||||
// Autoriser les requêtes depuis n'importe quelle origine
|
||||
// ==========================================
|
||||
// 1. GESTION CORS (À METTRE TOUT EN HAUT)
|
||||
// ==========================================
|
||||
// Autoriser les requêtes depuis n'importe quelle origine (ou remplacez * par http://localhost)
|
||||
header("Access-Control-Allow-Origin: *");
|
||||
header("Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS");
|
||||
header("Access-Control-Allow-Headers: Content-Type, Authorization, X-Requested-With");
|
||||
|
||||
// Répondre immédiatement aux requêtes preflight OPTIONS
|
||||
// Répondre immédiatement aux requêtes preflight OPTIONS du navigateur
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') {
|
||||
http_response_code(200);
|
||||
exit();
|
||||
exit(); // On arrête le script ici pour l'OPTIONS
|
||||
}
|
||||
// ==========================================
|
||||
|
||||
require_once 'config.php';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user