Es sollte auf die notwendigen Header geachtet werden:
```
Access-Control-Allow-Origin: http://foo.example
Access-Control-Allow-Methods: POST, GET, OPTIONS
Access-Control-Allow-Headers: X-PINGOTHER, Content-Type
Access-Control-Max-Age: 86400
TorstenHettstedt marked this conversation as resolved
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Der Server muss CORS und Preflight kennen.
@@ -0,0 +23,4 @@public function process(Request $request, RequestHandler $handler): Response{$response = $handler->handle($request);zu viele Zeilen.
@@ -0,0 +39,4 @@if ($this->testRoute($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-Headers', $requestHeaders);Da fehlt noch was:
Access-Control-Max-Age: 86400@@ -0,0 +42,4 @@$response = $response->withHeader('Access-Control-Allow-Headers', $requestHeaders);// Optional: Allow Ajax CORS requests with Authorization header$response = $response->withHeader('Access-Control-Allow-Credentials', 'true');Braucht es das wirklich?
@@ -11,0 +13,4 @@$I->haveHttpHeader('Origin', Api::TEST_ORIGIN);$I->haveHttpHeader('Access-Control-Request-Method', 'GET');$I->sendOptions('/views/working-hours/monthly');$I->seeResponseCodeIs(HttpCode::OK);Es sollte auf die notwendigen Header geachtet werden: