OLD | NEW |
(Empty) | |
| 1 <?php |
| 2 if ($_SERVER["REQUEST_METHOD"] == "OPTIONS") { |
| 3 // Check that the names in Access-Control-Request-Headers are |
| 4 // "sorted lexicographically, and byte lowercased". |
| 5 // Fetch API Spec: https://fetch.spec.whatwg.org/#cors-preflight-fetch-0 |
| 6 if ($_SERVER["HTTP_ACCESS_CONTROL_REQUEST_HEADERS"] == |
| 7 'x-custom-s, x-custom-test, x-custom-u, x-custom-ua, x-custom-v') { |
| 8 header("Access-Control-Allow-Headers: x-custom-s, x-custom-test, x-custo
m-u, x-custom-ua, x-custom-v"); |
| 9 } else { |
| 10 header("HTTP/1.1 400"); |
| 11 } |
| 12 header("Access-Control-Allow-Origin: *"); |
| 13 header("Access-Control-Max-Age: 0"); |
| 14 } else if ($_SERVER["REQUEST_METHOD"] == "GET") { |
| 15 header("Access-Control-Allow-Origin: *"); |
| 16 header("Access-Control-Max-Age: 0"); |
| 17 if (isset($_SERVER["HTTP_X_CUSTOM_S"])) |
| 18 echo "PASS"; |
| 19 else |
| 20 echo "FAIL"; |
| 21 } |
| 22 ?> |
OLD | NEW |