[Mongrel] OT(?): ReverseProxy and URLs

Stan Baptista stan.baptista at gmail.com
Wed Feb 21 21:21:51 EST 2007


This could be OT. If so, just let me know and I apologize in advance.

I mentioned in an earlier email that I have Mongrel setup as a proxy server
behind Apache. Rails applications served by Mongrel do not find the CSS file
and hence no styles are displayed. In fact, many of the actions are not
found.The reason, I believe, is because the URLs for styles and actions
typically follow this pattern:

<!-- Style sheets -->
<link href="/stylesheets/style.css?1171939096" media="screen"
rel="Stylesheet" type="text/css" />

(Note the first '/'.)

When accessing a Rails app directly via a port# (http://10.4.1.84:5222)
things are fine, but not so when accessing via Apache (http://10.4.1.84/rss
).

Presumably, in this case, it's looking for the style sheet in the Apache
webroot and failing.

I'm fairly sure this is a ReverseProxy problem and also suspect it's not
uncommon. Before investigating too deeply, I wonder if some of you have
already found solutions.

The Apache httpd.conf VirtualHost directives are these:

NameVirtualHost 10.4.1.84

<VirtualHost 10.4.1.84>

    RewriteEngine on
    RewriteRule ^/rss(.*) http://10.4.1.84:5222$1 [P]
    RewriteRule ^/railstest(.*) http://10.4.1.84:8223$1 [P]

</VirtualHost>

<VirtualHost 10.4.1.84>

    ServerName rss
    ProxyPass / http://10.4.1.84:5222/
    ProxyPassReverse /rss http://10.4.1.84:5222/
    ProxyPreserveHost on

</VirtualHost>

<VirtualHost 10.4.1.84>

    ServerName railstest
    ProxyPass / http://10.4.1.84:8223/
    ProxyPassReverse /railstest http://10.4.1.84:8223/
    ProxyPreserveHost on

</VirtualHost>

Any help, as always, is appreciated.

Thanks,
Stan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20070221/53f66c4d/attachment.html 


More information about the Mongrel-users mailing list