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,