V
V
Vitaly Khnykin2013-11-06 13:32:16
Nginx
Vitaly Khnykin, 2013-11-06 13:32:16

restriction on proxy_store based on the size of the given file

There is the following logic:
the content is served from the proxy server,
if there is no file, the proxy server accesses http_backend and takes the file from there to its storage, gradually giving it away.

In the config, it looks like this:

    location / {
            aio on;
            directio 1m;
            root /mnt/data;
            try_files $uri @download_it;
    }

    location @download_it
    {
            aio on;
            directio 1m;
            root /mnt/data;
            proxy_store  on;
            proxy_store_access     user:rw group:rw all:rw;
            proxy_pass http://http_backend;
    }



The problem is that during peak hours, when there is an active return, if a large file appears (for example, 30 GB), then writing it to disk, small files lose the return a little, but this is not critical.

my question is whether it is possible to somehow read the response header http_backend and if the file is more than 4 gigabytes goes into the
proxy_store off mode; well, or even do a redirect to the server. on which the file exists.

The question is reduced to that how to make check on the heading received from an Upstream?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question