Skip to content

Instantly share code, notes, and snippets.

@vielhuber
Last active June 28, 2019 20:44
Show Gist options
  • Save vielhuber/e5e320aee847a0ea457ad6853fd58988 to your computer and use it in GitHub Desktop.
Save vielhuber/e5e320aee847a0ea457ad6853fd58988 to your computer and use it in GitHub Desktop.
CORS enable with pure #php
<?php
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, PUT, PATCH, DELETE, OPTIONS');
header('Access-Control-Allow-Headers: X-Requested-With, Content-Type, Authorization');
if(@$_SERVER['REQUEST_METHOD'] == 'OPTIONS') { die(); }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment