fixed cors check
This commit is contained in:
@@ -50,6 +50,8 @@ class mfBaseApicontroller {
|
||||
header("Access-Control-Allow-Methods: GET,POST,OPTIONS");
|
||||
header("Access-Control-Allow-Headers: X-Api-Key");
|
||||
|
||||
$this->log->debug("origin header: ".$this->headers['origin']);
|
||||
|
||||
if(preg_match('#^(https?)://(.+)(:\d+)?$#i', $this->headers['origin'], $m)) {
|
||||
$origin_proto = $m[1];
|
||||
$origin_hostname = $m[2];
|
||||
@@ -325,7 +327,7 @@ class mfBaseApicontroller {
|
||||
|
||||
$request_origin = ["proto" => false, "hostname" => ""];
|
||||
$m = [];
|
||||
if(preg_match('#^(https?)://(.+)(:\d+)?$#i', $this->headers['origin'], $m)) {
|
||||
if(preg_match('#^(https?)://(.+)(:\d+)?/?$#i', $this->headers['origin'], $m)) {
|
||||
$request_origin['proto'] = $m[1];
|
||||
$request_origin['hostname'] = $m[2];
|
||||
}
|
||||
@@ -337,7 +339,7 @@ class mfBaseApicontroller {
|
||||
$hostname = $origin;
|
||||
|
||||
$m = [];
|
||||
if(preg_match('#^(https?)://(.+)$#i', $origin, $m)) {
|
||||
if(preg_match('#^(https?)://(.+)/?$#i', $origin, $m)) {
|
||||
$proto = $m[1];
|
||||
$hostname = $m[2];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user