Skip to content

Instantly share code, notes, and snippets.

@pablorsk
Last active December 19, 2017 12:30
Show Gist options
  • Save pablorsk/07b02544ab9158caeab641becf4a7432 to your computer and use it in GitHub Desktop.
Save pablorsk/07b02544ab9158caeab641becf4a7432 to your computer and use it in GitHub Desktop.
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,DELETE,PUT';
add_header 'Access-Control-Allow-Headers' 'authorization,content-type,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control';
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Access-Control-Allow-Credentials' true;
add_header 'Content-Security-Policy' 'default-src "self"';
# add_header 'Content-Type' 'text/plain; charset=utf-8';
# add_header 'Content-Length' 0;
return 204;
} else {
add_header 'Access-Control-Expose-Headers' 'authorization,content-type,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control';
}
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,DELETE,PUT';
add_header 'Access-Control-Allow-Headers' 'authorization,content-type,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Access-Control-Allow-Credentials' true;
add_header 'Content-Security-Policy' 'default-src "self"';
if ($request_method = 'OPTIONS') {
return 204;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment