|
...
|
...
|
@@ -16,21 +16,21 @@ class EnableCrossRequestMiddleware |
|
|
|
public function handle($request, Closure $next)
|
|
|
|
{
|
|
|
|
$response = $next($request);
|
|
|
|
// $origin = $request->server('HTTP_ORIGIN') ?: '';
|
|
|
|
//// $allow_origin = [
|
|
|
|
//// 'http://localhost:8080',
|
|
|
|
//// ];
|
|
|
|
//// if (in_array($origin, $allow_origin)) {
|
|
|
|
// $header = [
|
|
|
|
//// 'Access-Control-Allow-Origin' => $origin,
|
|
|
|
// 'Access-Control-Allow-Origin' => '*',
|
|
|
|
// 'Access-Control-Allow-Headers' => '*',
|
|
|
|
// 'Access-Control-Expose-Headers' => '*',
|
|
|
|
// 'Access-Control-Allow-Methods' => 'POST, GET, OPTIONS',
|
|
|
|
// 'Access-Control-Allow-Credentials' => 'true',
|
|
|
|
// ];
|
|
|
|
// $response->headers->add($header);
|
|
|
|
//// }
|
|
|
|
$origin = $request->server('HTTP_ORIGIN') ?: '';
|
|
|
|
// $allow_origin = [
|
|
|
|
// 'http://localhost:8080',
|
|
|
|
// ];
|
|
|
|
// if (in_array($origin, $allow_origin)) {
|
|
|
|
$header = [
|
|
|
|
// 'Access-Control-Allow-Origin' => $origin,
|
|
|
|
'Access-Control-Allow-Origin' => '*',
|
|
|
|
'Access-Control-Allow-Headers' => '*',
|
|
|
|
'Access-Control-Expose-Headers' => '*',
|
|
|
|
'Access-Control-Allow-Methods' => 'POST, GET, OPTIONS',
|
|
|
|
'Access-Control-Allow-Credentials' => 'true',
|
|
|
|
];
|
|
|
|
$response->headers->add($header);
|
|
|
|
// }
|
|
|
|
return $response;
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|