Skip to content

Instantly share code, notes, and snippets.

@xydinesh
Forked from ponimas/nginx-cors.conf
Last active August 29, 2015 14:07
Show Gist options
  • Save xydinesh/fa05ed6352f90d2c8817 to your computer and use it in GitHub Desktop.
Save xydinesh/fa05ed6352f90d2c8817 to your computer and use it in GitHub Desktop.
location / {
more_set_headers 'Access-Control-Allow-Origin: $http_origin' 'Access-Control-Allow-Credentials: true';
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, DELETE, PUT';
add_header 'Access-Control-Allow-Headers' 'Authorization,Content-Type,Accept,Origin,User-Agent,DNT,Cache-Control,X-Mx-ReqToken,Keep-Alive,X-Requested-With,If-Modified-Since';
add_header 'Content-Length' 0;
add_header 'Content-Type' 'text/plain charset=UTF-8';
return 204;
}
uwsgi_pass flask;
include /etc/nginx/uwsgi_params;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment