[更新]修正接口token跨域header支持

This commit is contained in:
Anyon 2018-05-16 15:30:16 +08:00
parent a46c064d98
commit 6f898e5fdc
2 changed files with 3 additions and 3 deletions

View File

@ -39,11 +39,11 @@ class BasicApi
*/
public function __construct()
{
ToolsService::corsOptionsHandler();
$this->request = app('request');
Session::init(config('session.'));
ToolsService::corsOptionsHandler();
$sessionName = $this->request->header(session_name());
empty($sessionName) || session_id($sessionName);
$this->request = app('request');
}
/**

View File

@ -33,7 +33,7 @@ class ToolsService
header('Access-Control-Allow-Origin:*');
header('Access-Control-Allow-Credentials:true');
header('Access-Control-Allow-Methods:GET,POST,OPTIONS');
header('Access-Control-Allow-Headers:Accept,Referer,Host,Keep-Alive,User-Agent,X-Requested-With,Cache-Control,Cookie');
header('Access-Control-Allow-Headers:Accept,Referer,Host,Keep-Alive,User-Agent,X-Requested-With,Cache-Control,Cookie,' . session_name());
header('Content-Type:text/plain charset=UTF-8');
header('Access-Control-Max-Age:1728000');
header('HTTP/1.0 204 No Content');