From bcf604dc0aeae226617bbf1903c756c3ba412beb Mon Sep 17 00:00:00 2001 From: li Date: Thu, 28 May 2026 14:37:33 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20CORS=E6=94=B9=E4=B8=BA=E5=9B=9E=E6=98=BE?= =?UTF-8?q?Origin=EF=BC=8C=E5=8E=BB=E6=8E=89=E7=99=BD=E5=90=8D=E5=8D=95?= =?UTF-8?q?=E9=99=90=E5=88=B6=E5=92=8Ccredentials?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/onlinechip/controller/Pcapi.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/application/onlinechip/controller/Pcapi.php b/application/onlinechip/controller/Pcapi.php index 925e39d..76b8ac8 100755 --- a/application/onlinechip/controller/Pcapi.php +++ b/application/onlinechip/controller/Pcapi.php @@ -23,13 +23,13 @@ class Pcapi extends Controller{ parent::__construct(); // CORS headers $origin = Request::instance()->header('origin'); - $allowed = ['https://ww1.g7g7.top','https://m.g7g7.top','https://m1.g7g7.top','https://m3.g7g7.top','https://p.g7g7.top']; - if($origin && in_array($origin, $allowed)){ + if($origin){ header('Access-Control-Allow-Origin: '.$origin); - header('Access-Control-Allow-Headers: token, Origin, X-Requested-With, Content-Type, Accept, Authorization'); - header('Access-Control-Allow-Methods: POST,GET,PUT,DELETE,OPTIONS'); - header('Access-Control-Allow-Credentials: true'); + } else { + header('Access-Control-Allow-Origin: *'); } + header('Access-Control-Allow-Headers: token, Origin, X-Requested-With, Content-Type, Accept, Authorization'); + header('Access-Control-Allow-Methods: POST,GET,PUT,DELETE,OPTIONS'); if(Request::instance()->isOptions()){ exit(); }