Download Large Files Directly

Hy @ All,

Is there an Option in nginx to set a limit for the download filesize, so
that the requested file will be downloaded from the proxied server
(apache) directly?

Example:

testfile.bin over 10 MB, will send directly to apache

Client --> Apache

testfile.bin under 10 MB, will send to nginx cache and then to apache

Client --> nginx Cache --> Apache

Any Solutions?

Regards,

Maik U.

Client --> Apache

testfile.bin under 10 MB, will send to nginx cache and then to apache

Client --> nginx Cache --> Apache

Any Solutions?

You can implement the following solution:

  • any request passes to the Apache
  • probe the file size
  • if size over 10MB - serve it like you want
  • if under - send X-Accel-Redirect response to nginx

http://wiki.nginx.org/XSendfile

Alexander Kolesen wrote in post #991075:

Client --> Apache

testfile.bin under 10 MB, will send to nginx cache and then to apache

Client --> nginx Cache --> Apache

Any Solutions?

You can implement the following solution:

  • any request passes to the Apache
  • probe the file size
  • if size over 10MB - serve it like you want
  • if under - send X-Accel-Redirect response to nginx

http://wiki.nginx.org/XSendfile

Let me explain this with a other way:

if the file has a size over 10 MB then nginx will not cache the file in
the filesystem and it will downloaded directly from the apache

if the file has a size under 10 MB then nginx will cache the file in the
filesystem

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs