You can use this library on your server: https://github.com/barryvdh/laravel-cors
return [
/*
|--------------------------------------------------------------------------
| Laravel CORS
|--------------------------------------------------------------------------
|
| allowedOrigins, allowedHeaders and allowedMethods can be set to array('*')
| to accept any value.
|
*/
'supportsCredentials' => false,
'allowedOrigins' => ['*'],
'allowedHeaders' => ['Content-Type', 'X-Requested-With'],
'allowedMethods' => ['*'], // ex: ['GET', 'POST', 'PUT', 'DELETE']
'exposedHeaders' => [],
'maxAge' => 0,
]
allowedOrigins => [*] mean that you give access to your server, you can add ip's or dns for restrict access to your server
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…