Using mod_xsendfile and x_send_file with Mongrel

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 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>

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/
ProxyPassReverse / http://localhost:8000/
ProxyPreserveHost on


:throttle: 0
:docroot: public
:debug: false
:port: 8000
:timeout: 60
:daemon: true
:group: adam
:environment: development
:pid_file: log/
:cwd: /usr/home/user/myserver
:user: user
:group: user
:log_file: log/mongrel.log

when I use x_send_file with the following in one of my rails

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:

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 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,


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs