My setup:
thin running on port 1234 with --prefix /foobar
apache running on port 80
apache reverse proxies /foobar to thin on port 1234
I would like the static assets to not be served via the proxy to thin, but instead be served at /assets directly via apache instead.
I have to use a relative path because I don’t know the host name/ip of the rails application before startup (it’s app-in-a-box that should be able to be moved around).
I found config.action_controller.asset_host in production.rb, but I can’t set that to a relative path. When I do it gets confused and creates really bogus URLs.
How can I make this work?
First, I want to thank Geoff and darkliquid. I took what was in darkliquid’s link and worked on it to make it work for my case. The big challenge was that I wasn’t serving the rails application from the root of the webserver.
Notes:
thinis run with--prefix '/railsapp'on port 9999.LA-U(look-ahead) to get the final filename apache would use.IS_SUBREQcheck is to prevent the look-ahead (a sub request) from ever returning the proxy./railsapp/index.htmlrewrite is required because otherwise another rule in my apache conf would rewrite it to/index.html, which is a default ‘here’s what’s here’ page;404s are served elsewhere, though.Here’s the relevant part of the apache configuration: