Skip to content

Instantly share code, notes, and snippets.

@grrywlsn
Created June 6, 2016 22:47
Show Gist options
  • Save grrywlsn/f26b1c2504259677680b468d4c8fad1f to your computer and use it in GitHub Desktop.
Save grrywlsn/f26b1c2504259677680b468d4c8fad1f to your computer and use it in GitHub Desktop.
Proxying Nginx to S3
location ~* ^/(.*) {
set $s3_bucket = "<bucket-name>.s3-website-eu-west-1.amazonaws.com";
proxy_http_version 1.1;
proxy_buffering off;
proxy_ignore_headers "Set-Cookie";
proxy_hide_header x-amz-id-2;
proxy_hide_header x-amz-request-id;
proxy_hide_header x-amz-meta-s3cmd-attrs;
proxy_hide_header Set-Cookie;
proxy_set_header Host $s3_bucket;
proxy_set_header Authorization "";
proxy_intercept_errors on;
proxy_pass http://$s3_bucket/$1;
break;
}
@grrywlsn
Copy link
Author

shouldn't it be set $s3_bucket "<bucket-name>.s3-website-eu-west-1.amazonaws.com"; (no =)?

Yep, that will be more syntactically correct. (Full disclosure, this file is 4 years old and I haven't touched this since).

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