On Saturday, March 26, 2011 9:15:48 PM UTC+11, Gustavo Narea wrote:
>
>  On 26/03/11 00:17, Graham Dumpleton wrote: 
>
>  Why guess in the first place? Apache and Nginx both support 'X-Sendfile:
>> <absolute path>' don't they? (older nginx seemed to only support their
>> own syntax, though).
>>
> Apache requires a separate module to be installed which isn't part of the 
> core, so no you can't rely on it being present.
>
>
> Indeed. Plus, the meaning of the path you give to the server has a totally 
> different meaning in Nginx, compared to that Apache module.
>

Yes and no as nginx also has a X-Sendfile module, again possibly optional 
(can't remember).

In Apache/mod_wsgi when using daemon mode you have CGI style 200/Location to 
use as well.

So, you have a mix of file system path and URL based schemes. In the case of 
file system based schemes, because the code processing X-Sendfile is 
potentially a different process, then you also have to deal with issues of 
that other process not having the required permissions to access the file 
even though the original application did.

For URL based schemes, nginx has an easy way to designate the URLs which are 
the target of X-Accel-Redirect are private and only accessible from a sub 
request triggered by the header. For Apache when using 200/Location, you 
have to use a mod_rewrite rule to effect private URLs.

Other proxy/load balancing front ends such a Pound and Squid (???) also 
support their own headers for this sort of URL sub requests.

Add to this wsgi.file_wrapper and you have three different schemes one can 
use. For the case of URL mechanism, there also various headers and consumers 
of the headers.

One of the Django tickets about this has an explanation about all the 
various options.

In short, it is all a mess and trying to provide support for it in one bit 
of code is possibly asking a bit much.

Graham

 

>
> In that Apache module and Lighttpd, the path set in the "X-Sendfile" header 
> is a path on the filesystem. In Nginx (header "X-Accel-Redirect") and CGI 
> (heder "Location"), the path is a URL path within the same host.
>
> -- 
> Gustavo Narea.
> Software Developer.
> 2degrees, Ltd. <http://www.2degreesnetwork.com/> 
> <http://www.2degreesnetwork.com/>.
>
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to