We have a Centos server with a number of virtual hosts, and my rails app
runs under one of those virtual hosts using mongrel_rails. The app lives
in /home/mydomain/railsapp where /home/mydomain/railsapp/public is the
rails root.
It runs under mongrel on port 8008, so to get to it users invoke the url http://www.mydomain.com:8008/ - all is fine to this point.
Now I have some users whose firewalls forbid these semantics, so I went
and configured apache (v1.3) to have mod_proxy in an attempt to get the
:8008 out of the URLs the user submits.
It works beautifully when the user invokes http://www.mydomain.com. I
believe all my paths within the app are relative to the rails root. Now
here is the PROBLEM.
I cannot use ‘/’ for the proxy since mydomain.com needs to work for the
website that already predates the rails app, and in fact wants to offer
it to it’s users. So I changed the mod_proxy rules in apache to:
Well this works but the problem is that all the links I created using
the link_to method do not invoke http://www.mydomain.com/tourney/controller/etc,
the merely are relative hrefs that look like
href=“/mycontroller/mymethod/etc”
and as a result do not go to the proper pages.
How do I fix this? Why is it different when I specify a subdir versus
just specifying ‘/’ in my proxy? I have tried using:
ActionController::AbstractRequest.relative_url_root = “/myapp” and it
just does not help. I am extremely confused and tired. I can’t help but
feel I’m getting close. It’s taken the last 2 days to get mod_proxy
working. Any help is appreciated.
ActionController::AbstractRequest.relative_url_root = “/myapp” and it
just does not help. I am extremely confused and tired. I can’t help but
feel I’m getting close. It’s taken the last 2 days to get mod_proxy
working. Any help is appreciated.
OK Zed I have the latest installed and everything runs fine as before in
the basic setup where I just run off http://www.mydomain.com:8008/
However I am confused as to how to use the URI. If I set the prefix to
anything when mongrel starts it says it is listening and available on
0.0.0.0:refix.
Zed I mad some progress. I disabled all the mod_proxy business. I took
my app which was in /home/mydomain/test with
railsroot=/home/mydomain/test/public, and copied the whole tree over to
/home/mydomain/public_html – so now there is
/home/mydomain/public_html/test with the usual rails subdirs under it.
If I start up mongrel_rails start -prefix /test/public I can reference
the app by the URL http://www.mydomain.com/test/public. All my link-to’s
are fine.
I did find that anywhere in a view where I hand-coded html for an image
where I said did not work. However if I
recoded it to use <%= image_tag etc %> instead it found the images
properly.