How to use Nginx as a proxy for S3 compatible storage with version 4 signature?

Reinis Rozitis r at
Wed Dec 14 13:54:09 UTC 2016

> It would be easy to proxy requests like this:

> but with version4 we need to send requests like:
> https://<bucket><my_files>

> The problem is that s3storage is a private node which hasn't a public domain. Only Nginx (which is a public node) can see s3storage.
> Does somebody know how to properly proxy such requests?

If you allready have a previous working configuration for the above setup then changing the hostname which nginx uses for the backend is kind of simple – you just need to pass a Host header which works for the S3 backend (by default nginx uses whatever is in the proxy_pass directive either IP or the name from upstream {} block). 

It wasn’t exactly clear (to me) how the client interacts with nginx (which is the correct url)  I mean if it sends the request using https://<bucket><my_files> to nginx you can just use a simple config:

A generic example (optionally the backend can be defined in seperate upstream {} block):

server {
        server_name <bucket>;
        location / { 
                proxy_set_header Host <bucket>;
                proxy_pass           https://yours3backendhostname;

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list