Add CORS headers for JSON output of index / overview

This commit is contained in:
Joshua Ramon Enslin 2021-02-17 18:03:04 +01:00
parent e423668d93
commit 36493ff072
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE

View File

@ -35,6 +35,12 @@ $fieldsGetter = new CsvxmlAvailableFields($lang);
$availableFields = $fieldsGetter->getFields();
if ($outFormat === 'json') {
header('Cache-Control: no-cache, no-store, must-revalidate, max-age=0'); // HTTP/1.1
header('Pragma: no-cache'); // HTTP/1.0
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: GET");
header("Access-Control-Allow-Headers: X-PINGOTHER, Content-Type, Accept-Encoding, cache-control");
header("Access-Control-Max-Age: 86400");
header('content-type: application/json');
echo json_encode($availableFields);
return;