Redirecting root to mongrel prefix

Mongrel can be started with a prefix e.g.

  mongrel_rails start -p 3000 --prefix /foobar

So that all of the app's URLs are prefixed, e.g.

  http://localhost:3000/foobar   http://localhost:3000/foobar/posts   http://localhost:3000/foobar/posts/1

The problem is that if you hit just the root ( http://localhost:3000/ ) then mongrel responds with "NOT FOUND".

I tried adding an index.html to RAILS_ROOT/public that redirects to / foobar, but this results in an infinite loop.

Does anyone know how to get requests to the root to redirect to the prefix?

I think you are missing a piece of the puzzle, Apache and mod_proxy...

You would never run multiple app roots unless you had multiple apps and or a php app on / and a rails app on /app1...

If you want multiple apps running on your dev env just start them with -p 3001 -p 3002 ... ? much easier... but I guess that depends on what you are trying to do ...

Yes, this is running behind Apache. We have a Java app that runs at   http://java.ourdomain.com/foo

We have Apache proxy forwarding http://java.ourdomain.com/bar to   http://rails.ourdomain.com/bar

...so that ajax calls aren't cross-domain to the java app.

The issue with redirecting the root requests to the prefixed URL is more a matter of convenience, just so someone doesn't see "NOT FOUND" if they happen to hit the root URL.