-
-
Save kid/e6d4fa094e59d19ed958105b6def6532 to your computer and use it in GitHub Desktop.
nginx...
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
if ($cors = "simple") { | |
set $my_allow_origins "$http_origin"; | |
} | |
if ($cors = "preflight") { | |
set $my_allow_origins "$http_origin"; | |
set $my_allow_methods "GET, HEAD, POST, OPTIONS"; | |
set $my_allow_headers "Cache-Control"; | |
} | |
location / { | |
expires $expires; | |
add_header "Access-Control-Allow-Origin" $my_allow_origins; | |
add_header "Access-Control-Allow-Methods" $my_allow_methods; | |
add_header "Access-Control-Allow-Headers" $my_allow_headers; | |
if ($cors = "preflight") { | |
return 204; | |
} | |
try_files $uri /index.html; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment