From 1eaa0c87d36236b75773b4c6b4f59d10250243a3 Mon Sep 17 00:00:00 2001 From: Dominik Labudzinski Date: Wed, 12 Jun 2024 13:49:23 +0200 Subject: [PATCH] modify CORS add CORS for all requests as listener --- src/EventListener/CorsListener.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/EventListener/CorsListener.php b/src/EventListener/CorsListener.php index 2bdf2ff..ad162a0 100644 --- a/src/EventListener/CorsListener.php +++ b/src/EventListener/CorsListener.php @@ -43,7 +43,7 @@ public function onKernelResponse(ResponseEvent $event): void return; } $crossOriginHeaders = [ - 'Allow' => 'GET, OPTIONS', + 'Access-Control-Max-Age' => 600, 'Access-Control-Allow-Origin' => '*', 'Access-Control-Allow-Credentials' => 'true', 'Access-Control-Allow-Methods' => implode(',', [ @@ -64,7 +64,9 @@ public function onKernelResponse(ResponseEvent $event): void 'X-Requested-With', 'If-Modified-Since', 'Cache-Control', - 'Content-Type' + 'Content-Type', + 'Access-Control-Request-Method', + 'Access-Control-Request-Headers' ]), ]; $request = $event->getRequest();