From bc9cd379f817e1f4cecd7698fb58a03d776ab4c6 Mon Sep 17 00:00:00 2001 From: Dominik Labudzinski Date: Wed, 12 Jun 2024 14:09:36 +0200 Subject: [PATCH] modify CORS add CORS for all requests as listener --- src/EventListener/CorsListener.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/EventListener/CorsListener.php b/src/EventListener/CorsListener.php index ad162a0..84239c6 100644 --- a/src/EventListener/CorsListener.php +++ b/src/EventListener/CorsListener.php @@ -73,6 +73,9 @@ public function onKernelResponse(ResponseEvent $event): void if($request->headers->has('Origin')) { $crossOriginHeaders['Access-Control-Allow-Origin'] = $request->headers->get('Origin'); } + if($request->headers->has('Access-Control-Allow-Headers')) { + $crossOriginHeaders['Access-Control-Allow-Headers'][] = $request->headers->get('Access-Control-Allow-Headers'); + } $event->getResponse()->headers->add($crossOriginHeaders); }