Alle notwendigen Header werden mitgeliefert.

This commit is contained in:
2021-04-13 12:43:31 +02:00
parent 87f3bb3f0e
commit 6203f98e93
@@ -35,12 +35,12 @@ class OriginAccessControlHandler implements MiddlewareInterface
$requestHeaders = $request->getHeaderLine('Access-Control-Request-Headers');
if ($this->testRoute($request)) {
// Stunden Minuten Sekunden
$accessControlMaxAge = 24 * 60 * 60;
$response = $response->withHeader('Access-Control-Allow-Origin', $this->buildOrigin($request));
$response = $response->withHeader('Access-Control-Allow-Methods', implode(',', $methods));
$response = $response->withHeader('Access-Control-Allow-Headers', $requestHeaders);
// Optional: Allow Ajax CORS requests with Authorization header
$response = $response->withHeader('Access-Control-Allow-Credentials', 'true');
$response = $response->withHeader('Access-Control-Max-Age', (string)$accessControlMaxAge);
}
return $response;
}