From 9ae9e5c311b3b6112ff1705f5882a60c3cbac02a Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Tue, 2 Mar 2021 13:46:12 +0100 Subject: [PATCH] add CORS header in community server --- config/bootstrap.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/config/bootstrap.php b/config/bootstrap.php index c57f81374..55918ba20 100644 --- a/config/bootstrap.php +++ b/config/bootstrap.php @@ -193,6 +193,13 @@ Type::build('datetime') ->useImmutable(); Type::build('timestamp') ->useImmutable(); + +header('Access-Control-Allow-Origin: *'); +header('Access-Control-Allow-Methods: POST, GET, PUT, PATCH, DELETE, OPTIONS'); +header('Access-Control-Allow-Headers: *'); +if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') { + exit(0); +} /* * Custom Inflector rules, can be set to correctly pluralize or singularize