Skip to content

Instantly share code, notes, and snippets.

@wokamoto
Last active December 9, 2020 09:39
Show Gist options
  • Save wokamoto/03fe3fc7534b78d25c30 to your computer and use it in GitHub Desktop.
Save wokamoto/03fe3fc7534b78d25c30 to your computer and use it in GitHub Desktop.
[Nginx][S3] Nginx で S3 をリバースプロキシするための設定
location ~* ^/(get_s3)/(.*) {
set $s3_bucket 'your_s3_bucket_name.s3.amazonaws.com';
set $url_full "/$1/$2";
proxy_http_version 1.1;
proxy_set_header Host $s3_bucket;
proxy_set_header Authorization '';
proxy_hide_header x-amz-id-2;
proxy_hide_header x-amz-request-id;
proxy_hide_header Set-Cookie;
proxy_ignore_headers "Set-Cookie";
proxy_buffering off;
proxy_intercept_errors on;
resolver 172.16.0.23 valid=300s;
resolver_timeout 10s;
proxy_pass http://$s3_bucket/$url_full;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment