I want to deploy a rails app as a sub-url to an existing site.
So, I'm using ProxyPass in apache to proxy urls for /foo to localhost
on port
10000, where mongrel is listening.
Unfortunately, the helper functions in Rails like link_to seem to
insist on
providing absolute urls (ie. /admin). That will break with this
scheme, since
the /foo in the URL won't be maintained.
I want to deploy a rails app as a sub-url to an existing site.
So, I'm using ProxyPass in apache to proxy urls for /foo to localhost
on port
10000, where mongrel is listening.
Unfortunately, the helper functions in Rails like link_to seem to
insist on
providing absolute urls (ie. /admin). That will break with this
scheme, since
the /foo in the URL won't be maintained.
What is recommended for a deployment like this?
Thanks,
Mike
You can use --prefix with Mongrel to specify the subdirectory you want to run Rails under. E.g.:
mongrel_rails start -d -p 10000 \
-a 127.0.0.1 \
-e production \
--prefix /foo
Mike, any chance you could post the relevant code from your httpd.conf file?
I've been stumbling around, trying to figure this out, for a while now, and I've yet to get multiple sites working on one box, without having work done on DNS tables (which is not a possibility in this case).
However, this ProxyPass method seems to be the wrong approach for multiple sites on one box (Multiple virtual host? - Rails - Ruby-Forum) since it demands the changing of DNS tables, which I lack permission to do. [Commercial hosting is not a solution for me.]
What's the problem? In httpd.conf you just need something like this:
Unfortunately it's not enough, since proxypass only fixes http headers
and not page contents. The link_to function and it's brothers all seem
to want to use absolute urls instead of relative ones, a terrible
practice. I tried turning off that behaviour in the default html
options but it didn't seem to help.
In the end I used the mongrel option suggested and it's working great.
Still, I find it sad that Rails suffers from the same broken
assumptions about deployment as jakarta-tomcat.
I've been stumbling around, trying to figure this out, for a while now,
and I've yet to get multiple sites working on one box, without having
work done on DNS tables (which is not a possibility in this case).
However, this ProxyPass method seems to be the wrong approach for
multiple sites on one box
(Multiple virtual host? - Rails - Ruby-Forum) since it demands the
changing of DNS tables, which I lack permission to do. [Commercial
hosting is not a solution for me.]
It now works for me with a combination of proxypass, and mongrel's --
prefix option. Should work for you.