first commit
This commit is contained in:
28
app/Http/Middleware/Cors.php
Normal file
28
app/Http/Middleware/Cors.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
|
||||
class Cors
|
||||
{
|
||||
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
header("Access-Control-Allow-Origin: *");
|
||||
header('Access-Control-Allow-Methods: GET, POST, OPTIONS');
|
||||
header("Access-Control-Allow-Headers: *");
|
||||
// header('Access-Control-Allow-Credentials: true');
|
||||
|
||||
if (!$request->isMethod('options')) {
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user