Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 42 lines (34 sloc) 1.278 kb
1616c68 @DinoChiesa Update to fix prettyDate display in the drawMessages() func. There was
DinoChiesa authored
1 <?php
2 //
3 // CORS allows HTML5 apps running in modern browsers
4 // to make valid cross-origin requests.
5 //
6 // For more on CORS, see
7 // http://en.wikipedia.org/wiki/Cross-origin_resource_sharing
8 //
9 // This PHP module sets the appropriate headers in the webserver
10 // response, to tell browsers that it's ok to connect to
11 // api.usergrid.com directly from script.
12 //
13 // Another way to add this header is to do so via Webserver
14 // configuration. You can use one or the other, but you do not need
15 // both.
16 //
17 // NB: This file will work only on webservers that have PHP enabled.
18 //
19
20 // Specify domains from which requests are allowed
21 header('Access-Control-Allow-Origin: https://api.usergrid.com');
22
23 // Specify which request methods are allowed
24 header('Access-Control-Allow-Methods: GET, POST, OPTIONS');
25
26 // Additional headers which may be sent along with the CORS request
27 // The X-Requested-With header allows jQuery requests to go through
28 header('Access-Control-Allow-Headers: X-Requested-With');
29
30 // Set the age to 1 day to improve speed/caching.
31 header('Access-Control-Max-Age: 86400');
32
33 // Exit early so the page isn't fully loaded for options requests
34 if (strtolower($_SERVER['REQUEST_METHOD']) == 'options') {
35 exit();
36 }
37
38 // delegate to the view
39 include './index.html';
40
41 ?>
Something went wrong with that request. Please try again.