Commit 24ff0623 authored by thiaramus's avatar thiaramus
Browse files

Added workaround for Cross Origin Resource Sharing to support Cross-Domain Ajax Requests

parent 3eb5065c
......@@ -20,6 +20,20 @@
*
*/
// A simple CORS workaround
if ("OPTIONS" == $_SERVER['REQUEST_METHOD']) {
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: POST, GET, PATCH, OPTIONS');
header('Access-Control-Max-Age: 1000');
if (array_key_exists('HTTP_ACCESS_CONTROL_REQUEST_HEADERS', $_SERVER)) {
header('Access-Control-Allow-Headers: '
. $_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']);
} else {
header('Access-Control-Allow-Headers: *');
}
exit(0);
}
require_once 'include/init.inc.php';
// Grab request URI and parse it into the array
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment