1
0

CORS korrigiert

This commit is contained in:
Anna Christina Naß
2025-07-07 17:54:14 +02:00
parent 730e1a044c
commit f6717560c0
2 changed files with 10 additions and 26 deletions

View File

@@ -2,7 +2,16 @@
include 'config.php';
include 'functions.php';
cors();
// CORS
header("Access-Control-Allow-Origin: *");
header('Access-Control-Max-Age: 86400'); // cache for 1 day
if (strtolower($_SERVER['REQUEST_METHOD']) == 'options') {
http_response_code(204);
header("Access-Control-Allow-Headers: origin, content-type, accept");
header("Access-Control-Allow-Methods: GET, POST, OPTIONS");
header("Access-Control-Allow-Private-Network: true");
exit(0);
}
// Read the raw POST data
$data = json_decode(file_get_contents('php://input'), true)