-
-
Notifications
You must be signed in to change notification settings - Fork 7
Closed
Labels
commercialwill be fix in the commercial worldwill be fix in the commercial world
Description
It solves communication errors caused by unclear CORS(the same origin) security policies.
define("CORS_DOMAINS", "exts.kr,catswords.re.kr");
// ... (생략) ...
// CORS Security (https or http)
if(CORS_DOMAINS !== false) {
$domains = explode(",", CORS_DOMAINS);
$_origin = $_SERVER['HTTP_ORIGIN'];
$origins = array();
if(!in_array("*", $domains)) {
foreach($domains as $domain) {
if(!empty($domain)) {
$origins[] = sprintf("https://%s", $domain);
$origins[] = sprintf("http://%s", $domain);
}
}
if(count($origins) > 0) {
if(in_array($_origin, $origins)) {
header(sprintf("Access-Control-Allow-Origin: %s", $_origin));
} else {
header(sprintf("Access-Control-Allow-Origin: %s", $origins[0]));
}
}
} else {
header("Access-Control-Allow-Origin: *");
}
}
Metadata
Metadata
Assignees
Labels
commercialwill be fix in the commercial worldwill be fix in the commercial world