Minor: if you _don't_ use nginx but rather apache or lighttpd,
similar feature is called "X-Sendfile".
On Feb 23, 5:00 am, David De La Harpe Golden
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.
Thus:
# 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'.
Graham