Initial commit: Retribusi frontend dengan dashboard, event logs, dan settings
This commit is contained in:
21
api/cors_handler.php
Normal file
21
api/cors_handler.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* CORS Handler - WAJIB di-include di awal SETIAP endpoint
|
||||
*
|
||||
* INSTRUKSI:
|
||||
* 1. Copy file ini ke server API
|
||||
* 2. Include di awal SETIAP file endpoint: require_once 'cors_handler.php';
|
||||
* 3. Atau copy kode di bawah ke awal setiap endpoint
|
||||
*/
|
||||
|
||||
// ================= CORS =================
|
||||
header("Access-Control-Allow-Origin: *");
|
||||
header("Access-Control-Allow-Methods: GET, POST, OPTIONS");
|
||||
header("Access-Control-Allow-Headers: Content-Type, Authorization, X-API-KEY");
|
||||
|
||||
// Handle preflight OPTIONS request
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') {
|
||||
http_response_code(200);
|
||||
exit;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user