-
-
Save ramanqul/a7b6c02e1c3988f7ee38ae555b768a70 to your computer and use it in GitHub Desktop.
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 ($request_method = OPTIONS) { | |
# Handle OPTIONS method | |
add_header Content-Length 0; | |
add_header Content-Type text/plain; | |
return 204; | |
} | |
# Headers get added no matter the request method | |
more_set_headers "Access-Control-Allow-Credentials: true"; | |
more_set_headers "Access-Control-Allow-Methods: GET, POST, PUT, DELETE"; | |
more_set_headers "Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Api-Password"; | |
more_set_headers "Access-Control-Allow-Origin: $allowed_origin"; | |
more_set_headers "Access-Control-Max-Age: 600"; | |
more_set_headers "Vary: Origin"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment