Skip to content

Instantly share code, notes, and snippets.

@Panthro
Last active April 27, 2016 19:46
Show Gist options
  • Save Panthro/a322755a924957cb6657b5fa99531929 to your computer and use it in GitHub Desktop.
Save Panthro/a322755a924957cb6657b5fa99531929 to your computer and use it in GitHub Desktop.
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
#
# Custom headers and headers various browsers *should* be OK with but aren't
#
add_header 'Access-Control-Allow-Headers' 'Accept,Content-Type,Authorization,User-Agent,If-Modified-Since,Cache-Control';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment