I'm using mod_xsendfile (v0.12) from https://tn123.org/mod_xsendfile/ to serve static files where Django is controlling access to the files based on users and permissions.
In my conf file, I have:
XSendFile On XSendFilePath e:/documents/
Order allow,deny Allow from all
In my django code, I set the headers like so:
assert(isinstance(filename, FieldFile))
xsendfile = filename.name
if(platform.system() == 'Windows'):
xsendfile = xsendfile.replace('\\', '/')
response = HttpResponse()
response['X-Sendfile'] = xsendfile
mimetype = mimetypes.guess_type(xsendfile)[0]
response['Content-Type'] = mimetype
response['Content-Length'] = filename.size
And in my log file I get:
[Fri Oct 22 08:54:22 2010] [error] [client 192.168.20.34] (20023)The given path
was above the root path: xsendfile: unable to find file:
e:/Documents/3/2010-10-20/TestDocument.pdf
In this version of mod_xsendfile,
XSendFileAllowAbove On
generates the error:
Invalid command 'XSendFileAllowAbove', perhaps misspelled or defined by a module
not included in the server configuration
I assumed that was because they have added the XSendFilePath white list. Anyone else got this to work?