# Using mod\_xsendfile and x\_send\_file with Mongrel

**URL:** <https://www.ruby-forum.com/t/using-mod-xsendfile-and-x-send-file-with-mongrel/123474>\
**Category:** Mongrel\
**Created:** [December 18, 2007, 2:54am UTC](https://www.ruby-forum.com/t/using-mod-xsendfile-and-x-send-file-with-mongrel/123474 "2007-12-18T02:54:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![random52k](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/7bcc69/32.png) [@random52k](https://www.ruby-forum.com/u/random52k)\
**Post date:** [December 18, 2007, 2:54am UTC](https://www.ruby-forum.com/t/using-mod-xsendfile-and-x-send-file-with-mongrel/123474/1 "2007-12-18T02:54:26Z")

</div>

Can anyone tell me how to get x\_send\_file working with mongrel 1.1.1  
and apache 2.2? I’ve installed the mod\_xsendfile apache module from  
[tn123.ath.cx is offline](http://tn123.ath.cx/mod_xsendfile/) and it works fine serving content  
from a PHP script, but I can’t get it to work with my single Mongrel  
instance and ProxyPass.

I’m using the following Apache configuration:

\<VirtualHost \*:80\>  
ServerName [myserver.com](http://myserver.com)

 XSendFile on XSendFileAllowAbove on 

ProxyPass /images !  
ProxyPass /stylesheets !

#continue with other static files that should be served by apache

Alias /images /home/user/myserver/public/images  
Alias /stylesheets /home/user/myserver/public/stylesheets

#continue with aliases for static content

ProxyPass / [http://localhost:8000/](http://localhost:8000/)  
ProxyPassReverse / [http://localhost:8000/](http://localhost:8000/)  
ProxyPreserveHost on

mongrel.yml:

* * *

:host: 127.0.0.1  
:throttle: 0  
:includes:  
:docroot: public  
:debug: false  
:mime\_map:  
:port: 8000  
:timeout: 60  
:num\_processors:  
:config\_script:  
:daemon: true  
:group: adam  
:environment: development  
:pid\_file: log/mongrel.pid  
:cwd: /usr/home/user/myserver  
:prefix:  
:user: user  
:group: user  
:log\_file: log/mongrel.log

when I use x\_send\_file with the following in one of my rails  
controllers:

x\_send\_file(@order.file\_name, :type =\> ‘text/plain;  
charset=us-ascii’, :disposition =\> ‘inline’)

I get the following error in my apache log:

No such file or directory: xsendfile: cannot open file:  
proxy:[http://localhost:8000/admin/orders/send\_raw\_order\_file/1/my\_order\_file.txt](http://localhost:8000/admin/orders/send_raw_order_file/1/my_order_file.txt)

I’ve tried a few things but I can’t seem to get past this error… I  
had a feeling it was because Apache was still trying to pass the  
request through the proxy, which was prepending the  
[http://localhost:8000](http://localhost:8000) to the url, which may have cause dthe error, but  
I’ve tried it with a stylesheet file in my public/stylesheets dir  
(which is _not_ proxied - ie will still be served if Mongrel is shut  
down) and I still get the same error.

I have a feeling I’m missing something pretty simple, since it seems  
that most other people have managed to get this up and running without  
too much difficulty. If anyone has any suggestions, please let me  
know! Thanks,

Mke
