Created
November 1, 2021 16:21
-
-
Save dazecoop/37f5f82d795d849c9e217b8b43136f44 to your computer and use it in GitHub Desktop.
Basic PHP CORS
This file contains 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
if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') { | |
header('Access-Control-Allow-Origin: *'); | |
header('Access-Control-Allow-Methods: POST, GET, DELETE, PUT, PATCH, OPTIONS'); | |
header('Access-Control-Allow-Headers: token, Content-Type'); | |
header('Access-Control-Max-Age: 1728000'); | |
header('Content-Length: 0'); | |
header('Content-Type: text/plain'); | |
die(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment