On Feb 23, 5:00 am, David De La Harpe Golden
<david.delaharpe.gol...@ichec.ie> wrote:
> On 22/02/10 16:48, Brice Leroy wrote:
> > Hello Brett,
> > If you use nginx you can use the X-Accel-Redirect function.
> Minor: if you _don't_ use nginx but rather apache or lighttpd,
> similar feature is called "X-Sendfile".

If you are using mod_wsgi 3.X and use its daemon mode, you can also
use 'Location' response header with status of 200 just like in CGI and
wouldn't require mod_sendfile. Using 'Location' is like using 'X-Accel-
Redirect' in nginx in that it is a URL which is remapped on the
server. The difference is that in Apache you have to use a mod_rewrite
rule if you want to mark a part of URL namespace as not public, but
instead only accessible from an Apache subrequest.


  # Map URL for private files.

  Alias /private/ /some/path/private/

  # Block access to private files except from an Apache sub request.

  RewriteCond %{IS_SUBREQ} !true
  RewriteRule  ^/private/ [F]

The application would then return response header:

  Location: /private/secret.txt

The status code returned for the HTTP request should be '200'.


You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to