Commit 399e7158 authored by tufengqi's avatar tufengqi

fix options

parent fef1715c
......@@ -21,8 +21,15 @@ class ResponseMsg
public function fzmCrossHeader()
{
$this->header('Access-Control-Allow-Origin', '*');
$this->header('Access-Control-Allow-Methods', 'POST,GET');
$allow_list = \Yii::$app->fpf->getConfig('allow_options_domain', 'common');
$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-Headers', 'Authorization,FZM-REQUEST-OS,FZM-USER-IP,FZM-REQUEST-UUID,Content-Type,Content-Length');
}
......
......@@ -4,4 +4,7 @@ $config['coin_type'] = [
2 => 'BTC',
3 => 'ETH',
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