Skip to content

Instantly share code, notes, and snippets.

@czwen
Created October 30, 2020 14:59
Show Gist options
  • Save czwen/140646f8dc4845bfb659911d471b8018 to your computer and use it in GitHub Desktop.
Save czwen/140646f8dc4845bfb659911d471b8018 to your computer and use it in GitHub Desktop.
nginx cors
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
if ($request_method = 'OPTIONS') { return 204; }
@czwen
Copy link
Author

czwen commented Oct 30, 2020

add_header add always if need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment