X-Accel-Buffering, proxy_buffering and proxy_store


#1

Hi everyone,

I’m trying to set up safe file downloading with Nginx. My config file
stripped down to most important elements looks like this:

upstream tempurl {
    server tempurl:8888;
}
upstream storage {
    server storage:8888;
}
server {
    listen 8888;
    location / {
        proxy_pass http://tempurl;
    }
    location /storage {
        root storage_cache;
        try_files $uri @storage;
    }
    location @storage {
        rewrite ^/storage/(.*) /$1 break;
        proxy_pass http://storage;
        proxy_store storage_cache$uri;
    }
}

The idea is that a user obtains somehow a temporary URL to a file and
asks my server for it. Then my server asks the “tempurl” server to
resolve it to real file name. The “tempurl” server returns
X-Accel-Redirect header with real path to the file. The file is
located on “storage” server, so we download it from there and
simultaneously mirror it by using try_files and proxy_store
directives.

My question is: The “tempurl” server can send X-Accel-Buffering header
and I can use proxy_buffering directive. How will these two interact
with proxy_store? I’d like to avoid unnecessary disk reads/writes and
avoid blocking worker by sending response to a user with slow
connection. Where should I use buffering and where shouldn’t I in the
above situation?

Regards,

Mike


#2

Hi,

Guys, any help about this? I still haven’t figured anything… I
couldn’t find it in the documentation and nothing came out of trying
to read Nginx source code…

Moreover, there’s another question to it: Can I use FLV module in my
configuration?

Cheers,

Mike