# Problem when downloading files with xsendfile

**URL:** <https://www.ruby-forum.com/t/problem-when-downloading-files-with-xsendfile/195641>\
**Category:** Mongrel\
**Created:** [September 27, 2010, 2:51pm UTC](https://www.ruby-forum.com/t/problem-when-downloading-files-with-xsendfile/195641 "2010-09-27T14:51:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![amit-singh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/9f8e36/32.png) [@amit-singh](https://www.ruby-forum.com/u/amit-singh)\
**Post date:** [September 27, 2010, 2:51pm UTC](https://www.ruby-forum.com/t/problem-when-downloading-files-with-xsendfile/195641/1 "2010-09-27T14:51:40Z")

</div>

Hii All, i loaded mod\_xsendfile.so in apche , i added few line in  
httpd.conf files

LoadModule xsendfile\_module modules/mod\_xsendfile.so

XSendFile on

XSendFileAllowAbove on

\<VirtualHost \* localhost:80\>  
ServerName src

DocumentRoot C:/InstantRails-2.0-win/rails\_apps/src/public/

ProxyPass / [http://localhost:3000/](http://localhost:3000/)

ProxyPassReverse / [http://localhost:3000/](http://localhost:3000/)

now in my rails application i have a streams controller and inside  
streams controller i have a function named download ,code for code  
download is below

def download

@stream = Stream.find(params[:id])

filename = “#{@stream.location}”

response.headers[‘Content-Type’] = “application/force-download”

response.headers[‘Content-Disposition’] = “attachment;  
filename="#{File.basename(filename)}"”

response.headers[“X-Sendfile”] = @stream.location

response.headers[‘Content-length’] = File.size(filename)

render :nothing =\> true

end

Problem is my rails application still handling this request but i would  
like apache to handle this request ,can anyone tell me how i configure  
apche to handle this request??

Actully when i downloding files,mongrel rendering things,

Processing StreamsController#download (for 127.0.0.1 at 2010-09-27  
16:50:47) [GET]  
Parameters: {“id”=\>“6655”}  
?[4;36;1mSQL (0.0ms)?[0m ?[0;1mSET NAMES ‘utf8’?[0m  
?[4;35;1mSQL (0.0ms)?[0m ?[0mSET SQL\_AUTO\_IS\_NULL=0?[0m  
?[4;36;1mStream Columns (0.0ms)?[0m ?[0;1mSHOW FIELDS FROM  
`streams`?[0m  
?[4;35;1mStream Load (0.0ms)?[0m ?[0mSELECT \* FROM `streams` WHERE  
(`streams`.`id` = 6655) ?[0  
Completed in 78ms (View: 0, DB: 0) | 200 OK  
[[http://src/streams/download/6655](http://src/streams/download/6655)]

It is when i am trying to download 2.2GB of file ,file is downloaded  
completely,but my worry is why mongrel is rendering things if apache is  
handling download
