This commit is contained in:
Kekskurse 2019-12-02 16:59:48 +01:00
parent 7a6e1a7adc
commit eea3f4452e
2 changed files with 7 additions and 1 deletions

View file

@ -21,3 +21,6 @@ S3_Bucket=abc
CACHE_DRIVER=file CACHE_DRIVER=file
QUEUE_CONNECTION=sync QUEUE_CONNECTION=sync
ENABLED_CORS=1
CORS_URL=*

View file

@ -14,8 +14,11 @@ class CorsMiddleware
*/ */
public function handle($request, Closure $next) public function handle($request, Closure $next)
{ {
if(getenv("ENABLED_CORS") == 0) {
return $next($request);
}
$headers = [ $headers = [
'Access-Control-Allow-Origin' => '*', 'Access-Control-Allow-Origin' => getenv("CORS_URL"),
'Access-Control-Allow-Methods' => 'POST, GET, OPTIONS, PUT, DELETE', 'Access-Control-Allow-Methods' => 'POST, GET, OPTIONS, PUT, DELETE',
'Access-Control-Allow-Credentials' => 'true', 'Access-Control-Allow-Credentials' => 'true',
'Access-Control-Max-Age' => '86400', 'Access-Control-Max-Age' => '86400',