Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have front end rails app, that reverse proxies to any of a number of backend rails apps depending on URL, for example reverse proxies to

such that a URL like will display the contents of

I have a large, and ever expanding number of backends, so they can not be explicitly listed anywhere other than a database. This is no problem for mod_rewrite using a prg:/ rewrite map reverse proxy.

The question is, the urls returned by rails helpers have the form /controller/action making them absolute to the root. This is a problem for the page served by mod_rewrite because links on the proxied page appear as absolute to the domain. i.e.: has links that end up looking like /controller/action/ when they need to look like /app_one/controller/action

mod_proxy_html seems like the right idea, but it doesn't seem to be as dynamic as I would need, since the rules need to be hard coded into the config files.

Is there a way to fix this server-side, so that the links will be routed correctly?

share|improve this question

You can try using ProxyPass and ProxyPassReverse.

ProxyPass /app_one
ProxyPassReverse /app_one

Though you are better off running your ruby apps under their named directories and reverse proxying directly back instead of doing a rewrite to change the uri.

You can look at unicorn, passenger or thin to run the ruby apps under to give more flexibility with how they are run.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.