This repository has been archived by the owner on Jul 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 72
/
index.php
41 lines (34 loc) · 1.25 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
//
// CORS allows HTML5 apps running in modern browsers
// to make valid cross-origin requests.
//
// For more on CORS, see
// http://en.wikipedia.org/wiki/Cross-origin_resource_sharing
//
// This PHP module sets the appropriate headers in the webserver
// response, to tell browsers that it's ok to connect to
// api.usergrid.com directly from script.
//
// Another way to add this header is to do so via Webserver
// configuration. You can use one or the other, but you do not need
// both.
//
// NB: This file will work only on webservers that have PHP enabled.
//
// Specify domains from which requests are allowed
header('Access-Control-Allow-Origin: https://api.usergrid.com');
// Specify which request methods are allowed
header('Access-Control-Allow-Methods: GET, POST, OPTIONS');
// Additional headers which may be sent along with the CORS request
// The X-Requested-With header allows jQuery requests to go through
header('Access-Control-Allow-Headers: X-Requested-With');
// Set the age to 1 day to improve speed/caching.
header('Access-Control-Max-Age: 86400');
// Exit early so the page isn't fully loaded for options requests
if (strtolower($_SERVER['REQUEST_METHOD']) == 'options') {
exit();
}
// delegate to the view
include './index.html';
?>