Init(Core): add to repo and add seeders
This commit is contained in:
30
app/Http/Middleware/myCors.php
Normal file
30
app/Http/Middleware/myCors.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class myCors
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
||||
*/
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
$origin = $request->header('Origin');
|
||||
if ($origin != 'http://localhost:3000'){
|
||||
$origin = 'https://app.axicon.ir';
|
||||
}
|
||||
return $next($request)
|
||||
->header('Access-Control-Allow-Origin', $origin)
|
||||
->header('Access-Control-Allow-Methods', 'POST, GET, OPTIONS, PUT, DELETE')
|
||||
->header('Access-Control-Allow-Credentials', 'true')
|
||||
->header('Access-Control-Allow-Headers', 'access-control-allow-origin,X-Requested-With,Content-Type,X-XSRF-TOKEN,Authorization')
|
||||
->header('Accept', 'application/json');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user