Comments

Gravatar

Tomislav — although you can achieve the same with X-Accel-Redirect, but I think their philosophy are different.

With X-sendfile, you can basically return any file on the local FS from your scripts, and no configuration is needed on the web server side. I think it is more flexible, but require smarter scripts to figure out where private data is.

With X-Accel-Redirect, the scripts and web server configuration are sharing that responsibility. Scripts tell the web server which file to return from that predefined location, and then web server can actually define the root of that location, abstracting from the scripts. I guess the idea is, you can just copy the scripts onto different deployment without modification, and you just need to configure web server properly.

However I found it is not often the case, as the scripts usually also need to know the absolute location of the files to return. For example I need to check the existence, size, geometry if it is an image file, etc. You might as well provide X-sendfile since scripts already know the absolute path to the files.

Reply

The content of this field is kept private and will not be shown publicly.

More information about formatting options