mod_xsendfile
mod_xsendfile copied to clipboard
Relative filenames do not work with mod_proxy_fcgi
Hello,
we have a PHP-FPM environment that's getting called by Apache via mod_proxy_fcgi:
<Proxy "fcgi://localhost/">
ProxySet timeout=86400
SetEnv proxy-chain-auth On
</Proxy>
<FilesMatch "\.php$">
SetHandler "proxy:unix:///var/run/fpm.sock|fcgi://localhost/"
</FilesMatch>
Enabling XSendFile and setting the header to just a filename:
<?php
header("X-Sendfile: test.txt");
Leads to an error, because the path mod_xsendfile is looking at has the proxy stuff prepended to it:
2018-02-06T15:11:39+01:00 example apache[4377]: [:error] [pid 4377:tid 3077586256] (2)No such file or directory: [client X.X.X.X:44044] xsendfile: cannot open file: proxy:fcgi://localhost//home/www/test.txt
Path should be /home/www/test.txt
Greetings, Takios