Question : header cross origin using php only for our domains and subdomain
Answered by : panicky-pollan-27vtxf8na4hr
$allowedOrigins = [ "http://www.websiteA.com", "https://www.websiteB.com" // ... etc
];
if (in_array($_SERVER["HTTP_ORIGIN"], $allowedOrigins)) { header("Access-Control-Allow-Origin: " . $_SERVER["HTTP_ORIGIN"]);
}
Source : https://stackoverflow.com/questions/9631155/specify-multiple-subdomains-with-access-control-origin/9737907 | Last Update : Fri, 04 Sep 20