Created
January 4, 2018 15:53
-
-
Save perico/6297c05e4bc509ed442986c56b24a519 to your computer and use it in GitHub Desktop.
Enable CORS in php hack
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
//Add this to your index.php | |
header("Access-Control-Allow-Origin: *"); | |
header("Access-Control-Allow-Methods: POST, PATCH, GET, OPTIONS, DELETE, PUT, HEAD"); | |
header("Access-Control-Max-Age: 1728000"); | |
header("Access-Control-Allow-Headers: Content-Type, origin, authorization, accept"); | |
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') | |
exit; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment