Commit 399e7158 authored by tufengqi's avatar tufengqi

fix options

parent fef1715c
...@@ -21,8 +21,15 @@ class ResponseMsg ...@@ -21,8 +21,15 @@ class ResponseMsg
public function fzmCrossHeader() public function fzmCrossHeader()
{ {
$this->header('Access-Control-Allow-Origin', '*'); $allow_list = \Yii::$app->fpf->getConfig('allow_options_domain', 'common');
$this->header('Access-Control-Allow-Methods', 'POST,GET'); $origin = \Yii::$app->request->headers->get('Origin');
if (in_array($origin, $allow_list)) {
$origin = '';
} else {
$origin = implode(',', $allow_list);
}
$this->header('Access-Control-Allow-Origin', $origin);
$this->header('Access-Control-Allow-Methods', 'POST,GET,OPTIONS');
$this->header('Access-Control-Allow-Credentials', 'true'); $this->header('Access-Control-Allow-Credentials', 'true');
$this->header('Access-Control-Allow-Headers', 'Authorization,FZM-REQUEST-OS,FZM-USER-IP,FZM-REQUEST-UUID,Content-Type,Content-Length'); $this->header('Access-Control-Allow-Headers', 'Authorization,FZM-REQUEST-OS,FZM-USER-IP,FZM-REQUEST-UUID,Content-Type,Content-Length');
} }
......
...@@ -5,3 +5,6 @@ $config['coin_type'] = [ ...@@ -5,3 +5,6 @@ $config['coin_type'] = [
3 => 'ETH', 3 => 'ETH',
4 => 'BTY' 4 => 'BTY'
]; ];
$config['allow_options_domain'] = [
'https://www.zhaobi.com/'
];
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment