Skip to content

Instantly share code, notes, and snippets.

@zefer
Created February 16, 2011 12:37
Show Gist options
  • Save zefer/829301 to your computer and use it in GitHub Desktop.
Save zefer/829301 to your computer and use it in GitHub Desktop.
Simple nginx config to allow CORS (cross-site) uploads to Amazon S3
location / {
if ($request_method = 'OPTIONS') {
more_set_headers 'Access-Control-Allow-Origin: *';
more_set_headers 'Access-Control-Allow-Methods: POST, OPTIONS';
more_set_headers 'Access-Control-Max-Age: 1728000';
more_set_headers 'Content-Type: text/plain; charset=UTF-8';
return 200;
}
if ($request_method = 'POST') {
more_set_headers 'Access-Control-Allow-Origin: *';
proxy_pass http://your-s3-bucket;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment