Created
June 20, 2013 00:36
-
-
Save ruckus/5819398 to your computer and use it in GitHub Desktop.
nginx: proxy files from S3. Let's masking the URL by pass Expires timestamp as e and Signature as st. For instance the basis URL is https://yourbucket.s3.amazonaws.com/readme.txt?AWSAccessKeyId=YOURONLYACCESSKEY&Signature=sagw4gsafdhsd&Expires=3453445231 Source: https://coderwall.com/p/rlguog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
location ~* ^/proxy_private_file/(.*) { | |
set $s3_bucket 'your_bucket.s3.amazonaws.com'; | |
set $aws_access_key 'AWSAccessKeyId=YOUR_ONLY_ACCESS_KEY'; | |
set $url_expires 'Expires=$arg_e'; | |
set $url_signature 'Signature=$arg_st'; | |
set $url_full '$1?$aws_access_key&$url_expires&$url_signature'; | |
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_ignore_headers "Set-Cookie"; | |
proxy_buffering off; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment