# Problem with send\_file & mod\_xsendfile: 1 byte file

**URL:** <https://www.ruby-forum.com/t/problem-with-send-file-mod-xsendfile-1-byte-file/170313>\
**Category:** Rails\
**Created:** [June 15, 2009, 8:56pm UTC](https://www.ruby-forum.com/t/problem-with-send-file-mod-xsendfile-1-byte-file/170313 "2009-06-15T20:56:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![amedse](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/b5a626/32.png) [@amedse](https://www.ruby-forum.com/u/amedse)\
**Post date:** [June 15, 2009, 8:56pm UTC](https://www.ruby-forum.com/t/problem-with-send-file-mod-xsendfile-1-byte-file/170313/1 "2009-06-15T20:56:53Z")

</div>

Hi everyone,

I’ve been installed mod\_xsendfile in my local computer under Apache 2.2,  
then I put the following lines in apache2.conf file:

LoadModule xsendfile\_module “/usr/lib/apache2/modules/mod\_xsendfile.so”  
XSendFile on  
XSendFileAllowAbove on

after restart Apache Server, the following command show me that  
xsendfile\_module has been loaded:

apache2ctl -t -D DUMP\_MODULES  
…  
xsendfile\_module (shared)

Now, in my Rails app (version 2.3.2) with mongrel in development  
environment I have the following lines in a controller:

send\_file("#{RAILS\_ROOT}/public#{@attachment.public\_filename}", :type =\>  
@attachment.content\_type, :x\_sendfile =\> true)  
render :nothing =\> true

When the method is executed the output in development.log says:

Sending X-Sendfile header  
/path/to/project/public/files/0000/0001/file.jpg  
Completed in 120ms

In the browser, the download file dialog appears and I download the  
file.

But the problem is: The downloaded file size is 1 byte, and that’s not  
the original file… it is a empty file…

What can be the problem?

Regards,
