Skip to content

Instantly share code, notes, and snippets.

@perico
Created January 4, 2018 15:53
Show Gist options
  • Save perico/6297c05e4bc509ed442986c56b24a519 to your computer and use it in GitHub Desktop.
Save perico/6297c05e4bc509ed442986c56b24a519 to your computer and use it in GitHub Desktop.
Enable CORS in php hack
//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