header set
This commit is contained in:
@@ -253,6 +253,24 @@ class WrenchApi extends BaseController
|
||||
return $in;
|
||||
}
|
||||
public function apigate(){
|
||||
|
||||
if (array_key_exists('HTTP_ORIGIN', $_SERVER)) {
|
||||
$origin = $_SERVER['HTTP_ORIGIN'];
|
||||
} else if (array_key_exists('HTTP_REFERER', $_SERVER)) {
|
||||
$origin = $_SERVER['HTTP_REFERER'];
|
||||
} else {
|
||||
$origin = $_SERVER['REMOTE_ADDR'];
|
||||
}
|
||||
$allowed_domains = array(
|
||||
'http://localhost:9082/',
|
||||
'https://users.wrenchboard.com/',
|
||||
);
|
||||
|
||||
|
||||
if (in_array($origin, $allowed_domains)) {
|
||||
header('Access-Control-Allow-Origin: ' . $origin);
|
||||
}
|
||||
|
||||
/*
|
||||
//$request = service('request');
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
|
||||
Reference in New Issue
Block a user