Skip to content

Instantly share code, notes, and snippets.

@Mikodes
Created May 26, 2015 15:04
Show Gist options
  • Save Mikodes/b26f57b870cbaab6eb24 to your computer and use it in GitHub Desktop.
Save Mikodes/b26f57b870cbaab6eb24 to your computer and use it in GitHub Desktop.
server {
location /
{
include uwsgi_params;
uwsgi_pass unix:/tmp/core.socket;
if ($request_method = 'OPTIONS') {
add_header Access-Control-Allow-Origin *;
#
# Om nom nom cookies
#
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS,PUT,DELETE,PATCH';
#
# Custom headers and headers various browsers *should* be OK with but aren't
#
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,authorization,origin';
#
# Tell client that this pre-flight info is valid for 20 days
#
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
}
location /ws/ {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://unix:/tmp/ws-core.socket;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment