getMethod()); if ($requestMethod == 'OPTIONS') { return $response ->withHeader('Accept', 'OPTIONS,GET,POST,PUT,PATCH,DELETE') ->withHeader('Access-Control-Allow-Origin', '*') ->withHeader('Access-Control-Allow-Methods', 'OPTIONS,GET,POST,PUT,PATCH,DELETE') ->withHeader('Access-Control-Allow-Headers', 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization'); } return $next($request, $response); } }