Skip to content

Commit

Permalink
modify CORS
Browse files Browse the repository at this point in the history
add CORS for all requests as listener
  • Loading branch information
labudzinski committed Jun 12, 2024
1 parent 1eaa0c8 commit bc9cd37
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/EventListener/CorsListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit bc9cd37

Please sign in to comment.