Sheikh Azad
Sheikh Azad

Reputation: 353

X-Sendfile works for all folder and not just XSendFilePath

I have xsendfile module working and files are being served using X-Sendfile header. But somehow files from any folder gets served. How do I rectrict it so that I can use X-sendfile headers only for specific folders? I have tried setting XSendFilePath, even then files outside that folder also get sent if I use X-Sendfile header.

This is what I have in my virtualhost section XSendFile on XSendFilePath /home/domain/public_html/files

If I use php to send files from /home/domain/public_html/abc using X-Sendfile. It gets sent without any problem. I do not want this. I only want X-Sendfile to work for files within /home/domain/public_html/files.

Upvotes: 0

Views: 2234

Answers (2)

Raffael Meier
Raffael Meier

Reputation: 309

It is imporant the the XSendFilePath directive is in a apache config file context that is relevant to the url you are using, e.g. not within a virtual host section which is not interpreted due your actual virtual host (in your url). probably and in most configurations, XSendFilePath is used in the main section of apache config file, not in a specific context like virtual host, dolmain, etc. does this help?

XSendFilePath /tmp
<VirtualHost *>
	ServerName www.someserver.com
	XSendFilePath /home/userxyz
</VirtualHost>

(first occurance of XSendFilePath -> works globally, second occurance does only work if your php script producting the XSendFile header is called from within domain www.someserver.com)

Upvotes: 0

Mircea Soaica
Mircea Soaica

Reputation: 2817

Try with the XSendFilePath directive

XSendFilePath allow you to add additional paths to some kind of white list. All files within these paths are allowed to get served through mod_xsendfile.

Upvotes: 1

Related Questions