Setting Applications URL prefix

hi all
am newish to ruby and rails and am playing around to see what can and
cant be done.
Am fairly comfortable with awith apache and am playing with using
apache as a reverse proxy for mongrel.

I want to achieve this:
http://localhost/myapp/ reverse proxies to http://localhost:8000/

which will later allow me to add http://localhost/myotherapp to reverse
proxy to http://localhost:8100/ for example.

In order for this to work, i need rails to append /myapp to the
begining of all the URLS it generates,and just to take it to the next
step, id like to configure ‘production’,development, and ‘testing’ to
be configurable to use different url prefixes, or none at all even.

Ive found details on net on how to do this with lighthttpd, but Im keen
to get it working with apache/mongrel. Any one done this, or
alternatively know why it cant/shouldnt be done?

thanks
Glenn