non-standard HTTP header supported by Apache to offload the process of serving large static files from dynamic scripts (eg: PHP, Python, Perl) after they have performed the necessary authorization or restriction logic.
Questions tagged [x-sendfile]
155 questions
7
votes
0 answers
How can I get mod_xsendfile to guess the MIME type of the file to serve?
I am using mod_xsendfile to serve static files using Apache. However, I cannot find a way to get Apache to set a Content-type header based on the extension of the file it serves using xsendfile. This seems a little odd, since Apache is able to do…

jameshfisher
- 34,029
- 31
- 121
- 167
6
votes
2 answers
Alternative of send_file() in flask on Pythonanywhere?
I am new to python and still learning. I created a small python 3.6 Flask webapp on pythonanwhere and found out that send_file() is not working on pythonanywhere servers. I am actively looking for an alternative to download an excel file directly on…

Hridesh Kohli
- 61
- 1
- 2
6
votes
3 answers
mod_xsendfile for Win x64?
I'm trying to install the mod_xsendfile Apache Module on Windows (7) x64 (using Apache 2.2) -- yes I'm doomed from the get-go, I know :-). Apparently there is :
a) No Win x64 binary for mod_xsendfile, just a Win32 binary from the module's…

Dr1Ku
- 2,875
- 3
- 47
- 56
6
votes
4 answers
PHP - How to find out if X-Sendfile is available and installed?
Basically, I would like to send a header X-Sendfile to the browser to send a file, but I don't want to call this if the X-Sendfile is not available or installed on the server. How can I check for this in PHP?? Or if this is impossible to check in…

Solomon Closson
- 6,111
- 14
- 73
- 115
5
votes
5 answers
X-SendFile on Apache2 (PHP) serving 0B file, no errors though
I installed mod_xsendfile and it seems to have been successful; xsendfile.load appears in /etc/apache2/mods-enabled, and I've found no errors when running my test script. However, every time I run it, I get served a 0B file.
Here's my test…

Doug Wollison
- 401
- 6
- 15
5
votes
0 answers
Apache mod-x-sendfile but for remote url
I'm writing a PHP application where users can download some files. Not all files can be downloaded by all users and some complicated rights-checking is going on behind the scenes.
Because of this rights-checking I don't want to expose the url where…

heisa
- 834
- 1
- 9
- 17
5
votes
1 answer
Nginx: X-Accel-Redirect not working in files with know MIME extension
I am developing a webapp and X-Accel-Redirect header works fine only in files without extension. For some reason, if I add an extension to the file name the X-Accel-Redirect doesn't work.
Working example:
X-Accel-Redirect:…

robregonm
- 627
- 6
- 15
5
votes
2 answers
xsendFile downloads have 0 bytes
On LAMP stack, I can not get xSendFile to work. The problem is that the downloads have 0 bytes.
In order to be sure that I have xSendFile installed, I have added this to my .htaccess file:
SetEnv MOD_mod_xsendfile…

Ivo Renkema
- 2,188
- 1
- 29
- 40
5
votes
3 answers
HTTP File Download: Monitoring Download Progress
I am in a situation, when I have to implement downloading of large files(up to 4GB) from a Web server: Apache 2.4.4 via HTTP protocol. I have tried several approaches, but the best solution looks to be the usage of X-SendFile module.
As I offer…

Bunkai.Satori
- 4,698
- 13
- 49
- 77
5
votes
1 answer
What's The Deal With X-SendFile?
In asking around and doing some research, it seems like many people are really pushing X-Sendfile as the preferred method of serving large downloadable files to a browser-based client from a PHP script.
Some methods I've been looking into…

MultiDev
- 10,389
- 24
- 81
- 148
4
votes
2 answers
Why am I receiving an HTTP 412 status error in React Native on subsequent downloads of a specific file?
I have created a React Native App that allows me to download Zip packages to my app. In most cases it has worked, I can download the zip package, delete a zip package, and re-download it again. However, with one of my zip files I am encountering the…

kojow7
- 10,308
- 17
- 80
- 135
4
votes
0 answers
Nginx + node.js + x-SendFile
I currently have a node.js server behind a nginx reverse proxy.
I would like to know if there is any performance benefits to using x-sendfile, rather than express "static" middleware or "sendFile" express method.
I'm also curious about the reason…

Poyoman
- 1,652
- 1
- 20
- 28
4
votes
2 answers
Saving animated GIFs using PIL (image saved does not animate)
I have Apache2 + PIL + Django + X-sendfile. My problem is that when I save an animated GIF, it won't "animate" when I output through the browser.
Here is my code to display the image located outside the public accessible directory.
def…

wenbert
- 5,263
- 8
- 48
- 77
4
votes
1 answer
How to use Nginx X-Accel with Symfony?
I would want to use Nginx X-Accel with Symfony, for the moment I've this code.
$request->headers->set('X-Sendfile-Type', 'X-Accel-Redirect');
$request->headers->set('X-Accel-Mapping', '/var/www/html/files/=/protected-files/');
…

mpiot
- 1,482
- 2
- 15
- 36
4
votes
1 answer
Capistrano & X-Sendfile
I'm trying to make X-Sendfile work for serving my heavy attachments with capistrano. I found that X-Sendfile is not working with symlinks. How could I handle the files inside a folder symlinked by Capistrano so?
my web server is apache2 +…

sissy
- 2,908
- 2
- 28
- 54