Created
March 18, 2015 11:38
-
-
Save tsvetomir/1658ebbdfdc705c78780 to your computer and use it in GitHub Desktop.
NGinx - CORS proxy
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
location /foo { | |
if ($request_method = 'OPTIONS') { | |
add_header 'Access-Control-Allow-Origin' '*'; | |
add_header 'Access-Control-Allow-Methods' 'POST, GET, PUT, DELETE, OPTIONS'; | |
add_header 'Access-Control-Allow-Headers' '*'; | |
add_header 'Access-Control-Max-Age' 1728000; | |
add_header 'Content-Type' 'text/plain charset=UTF-8'; | |
add_header 'Content-Length' 0; | |
return 200; | |
} | |
proxy_pass http://foo.com/; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment