Proxying large downloads from s3

Sudara Williams lists at
Tue Apr 1 17:59:45 UTC 2014

Hi guys!

We are proxying files from s3 through our app and had a couple questions
on ideal config.

When I arrived on the scene, the following config was in place:

location /download/ {
    proxy_buffering off;
    proxy_buffers 2 4m;
    proxy_buffer_size 4m;
    proxy_busy_buffers_size 4m;

I was called in because the server started running out of memory. (It
seemed fine for a long time, probably just didn't max out for a while)

After looking up config, it seemed like 4m was VERY large proxy_buffer
size. I was uncertain about whether proxy_buffering should be off or
not. recommends it off, but most of the
mailing list replies say unless you are using Comet or something,
there's no need for it to be off.

We removed all the extra proxy config and we ended up with something
like this:

location /download/ {
    proxy_buffering off;
    chunked_transfer_encoding off;

We also tried with proxy_buffering on. In both cases it seems like we
are seeing truncated responses. This especially happens on large files
– the file will just be "done" downloading early, and the zip file will
be corrupt.

We are also seeing errors like this, but uncertain if it's related.

2014/03/20 00:02:36 [error] 15519#0: *24132 upstream timed out (110:
Connection timed out) while reading response header from upstream,
client:, server: localhost, request: "GET
HTTP/1.1", upstream:
host: ""

I was suspicious of chunked_transfer_encoding  being off, so config now
looks like this:

location / {
    proxy_max_temp_file_size 256m;
    proxy_read_timeout 300;

We are now waiting to find out if our large downloads are still being
interrupted. But we would appreciate any advice about proxying large
files from s3. Should proxy_buffering be on or off?

Thanks :)


Posted via

More information about the nginx mailing list