Created
April 10, 2016 15:38
-
-
Save melvincarvalho/e401f79f1c79a8a38c7c85bebfb85fb3 to your computer and use it in GitHub Desktop.
cors.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| if (isset($_SERVER['HTTP_ORIGIN'])) { | |
| header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}"); | |
| header('Access-Control-Allow-Credentials: true'); | |
| } else { | |
| header('Access-Control-Allow-Origin : *'); | |
| } | |
| if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') { | |
| if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD'])) | |
| header("Access-Control-Allow-Methods: GET, POST, OPTIONS"); | |
| if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS'])) | |
| header("Access-Control-Allow-Headers: {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}"); | |
| exit(0); | |
| } | |
| header("Vary: Accept"); | |
| if (stristr($_SERVER["HTTP_ACCEPT"], "application/turtle")) { | |
| header("Content-Type: application/turtle"); | |
| } else { | |
| header("Content-Type: text/turtle"); | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment