Created
February 14, 2020 16:56
-
-
Save zodman/022128a0be3038b6dbf79a1a6b932b47 to your computer and use it in GitHub Desktop.
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
set $var_cors 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range,X-app-language,X-app-version,X-app-countr'; | |
if ($request_method = 'OPTIONS') { | |
add_header 'Access-Control-Allow-Origin' '*'; | |
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; | |
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range,X-app-language,X-app-version,X-app-country'; | |
add_header 'Access-Control-Max-Age' 1728000; | |
add_header 'Content-Type' 'text/plain charset=UTF-8'; | |
add_header 'Content-Length' 0; | |
return 204; | |
} | |
if ($request_method = 'POST') { | |
add_header 'Access-Control-Allow-Origin' '*' always; | |
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always; | |
add_header 'Access-Control-Allow-Headers' $var_cors always; | |
add_header 'Access-Control-Expose-Headers' $var_cors always; | |
} | |
if ($request_method = 'GET') { | |
add_header 'Access-Control-Allow-Origin' '*' always ; | |
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always ; | |
add_header 'Access-Control-Allow-Headers' $var_cors always; | |
add_header 'Access-Control-Expose-Headers' $var_cors always; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment