|
@@ 32-39 (lines=8) @@
|
| 29 |
|
|
| 30 |
|
$origin = $request->headers->get('Origin', ''); |
| 31 |
|
$host = $this->parseUrl($origin); |
| 32 |
|
if (empty($host)) { |
| 33 |
|
$this->logRequest('Origin is invalid', [ |
| 34 |
|
'origin' => $origin, |
| 35 |
|
'parsed' => $host, |
| 36 |
|
]); |
| 37 |
|
|
| 38 |
|
return $this->response($request, 'Origin is invalid', Response::HTTP_BAD_REQUEST); |
| 39 |
|
} |
| 40 |
|
|
| 41 |
|
$allowed_origins = config('lodash.cors.allow_origins', []); |
| 42 |
|
$current_app = $this->parseUrl((string) config('app.url', '')); |
|
@@ 55-62 (lines=8) @@
|
| 52 |
|
} |
| 53 |
|
} |
| 54 |
|
|
| 55 |
|
if (! $found) { |
| 56 |
|
$this->logRequest('Origin is not allowed', [ |
| 57 |
|
'origin' => $origin, |
| 58 |
|
'parsed' => $host, |
| 59 |
|
]); |
| 60 |
|
|
| 61 |
|
return $this->response($request, 'Origin is not allowed', Response::HTTP_METHOD_NOT_ALLOWED); |
| 62 |
|
} |
| 63 |
|
|
| 64 |
|
if ($request->method() === Request::METHOD_OPTIONS) { |
| 65 |
|
$allowed_headers = config('lodash.cors.allow_headers', []); |