Created
February 7, 2013 23:35
-
-
Save grampelberg/4735238 to your computer and use it in GitHub Desktop.
nginx CORS config
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
location / { | |
# For CORS | |
if ($request_method = OPTIONS ) { | |
add_header Access-Control-Allow-Origin $http_origin; | |
add_header Access-Control-Allow-Methods "GET, OPTIONS"; | |
add_header Access-Control-Allow-Headers 'Authorization,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,X-CSRF-Token,X-Zendesk-Lotus-Version'; | |
add_header Access-Control-Allow-Credentials "true"; | |
add_header Content-Length 0; | |
add_header Content-Type "text/plain charset=UTF-8"; | |
return 204; | |
} | |
if ($request_method = GET) { | |
add_header Access-Control-Allow-Origin $http_origin; | |
add_header Access-Control-Allow-Methods "GET, OPTIONS"; | |
add_header Access-Control-Allow-Headers 'Authorization,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,X-CSRF-Token'; | |
add_header Access-Control-Allow-Credentials "true"; | |
} | |
proxy_pass http://localhost:3000; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header Host $host; | |
proxy_redirect off; | |
proxy_max_temp_file_size 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment