header cross origin using php only for our domains and subdomain

Solutions on MaxInterview for header cross origin using php only for our domains and subdomain by the best coders in the world

showing results for - "header cross origin using php only for our domains and subdomain"
Carly
10 Mar 2016
1$allowedOrigins = [
2    "http://www.websiteA.com",
3    "https://www.websiteB.com"
4    // ... etc
5];
6
7if (in_array($_SERVER["HTTP_ORIGIN"], $allowedOrigins)) {
8    header("Access-Control-Allow-Origin: " . $_SERVER["HTTP_ORIGIN"]);
9}