Forum: Ruby on Rails Redirecting root to mongrel prefix

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D69d23d8e811e8ab2a8593380d6ede63?d=identicon&s=25 Jeff Emminger (jemminger)
on 2009-01-28 16:22
(Received via mailing list)
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?
4c438a80fc30661ad619ea177cf9cbd0?d=identicon&s=25 Freddy Andersen (Guest)
on 2009-01-28 17:50
(Received via mailing list)
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 ...
D69d23d8e811e8ab2a8593380d6ede63?d=identicon&s=25 Jeff Emminger (jemminger)
on 2009-01-28 18:13
(Received via mailing list)
On Jan 28, 11:50 am, Freddy Andersen <fre...@cfandersen.com> wrote:
> I think you are missing a piece of the puzzle, Apache and
> mod_proxy...
>

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.
This topic is locked and can not be replied to.