bugfixes/cors-problem #7

Merged
TorstenHettstedt merged 9 commits from bugfixes/cors-problem into master 2021-04-13 12:44:22 +02:00
Showing only changes of commit 6203f98e93 - Show all commits
1
@@ -35,12 +35,12 @@ class OriginAccessControlHandler implements MiddlewareInterface
$requestHeaders = $request->getHeaderLine('Access-Control-Request-Headers'); $requestHeaders = $request->getHeaderLine('Access-Control-Request-Headers');
if ($this->testRoute($request)) { 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-Origin', $this->buildOrigin($request));
$response = $response->withHeader('Access-Control-Allow-Methods', implode(',', $methods)); $response = $response->withHeader('Access-Control-Allow-Methods', implode(',', $methods));
$response = $response->withHeader('Access-Control-Allow-Headers', $requestHeaders); $response = $response->withHeader('Access-Control-Allow-Headers', $requestHeaders);
TorstenHettstedt marked this conversation as resolved
Review

Da fehlt noch was:
Access-Control-Max-Age: 86400

Da fehlt noch was: `Access-Control-Max-Age: 86400`
$response = $response->withHeader('Access-Control-Max-Age', (string)$accessControlMaxAge);
// Optional: Allow Ajax CORS requests with Authorization header
$response = $response->withHeader('Access-Control-Allow-Credentials', 'true');
} }
return $response; return $response;
TorstenHettstedt marked this conversation as resolved
Review

Braucht es das wirklich?

Braucht es das wirklich?
} }