Proxy, routes.rb, and urls


#1

Wondering if this is possible in an elegant global way to adjust RoR’s
urls…

Basically what I would like to do is make Rails aware that it needs to
have to adjust all the urls that refer to itself by a preceeding “/
rails” in the urls. I’ve tried things in routes.rb such as “map.test
‘rails/:controller, :action’”, etc…, but to no avail. Currently the
only way I’ve been able to do this is to more or less hard code it
( which may not be too bad of a thing in this case ) in any .rhtml
files with a link_to adjustment, as in
<%= link_to “newBYE”, :controller => “/rails/hello”, :action =>
“list_times” %>

Not knowing RoR well enough yet to know if this is going to be a
problem… but it seems to me a routes.rb generating solution would be
better. I wouldn’t think this would be that hard, but perhaps it’s
to much away from “convention over configuration”.

The reason I want to do this is because at first we’ll be using Apache
to proxy Rails requests, and the ‘/rails’ is the flag for Apache to
hit on the reverse proxy.

Thanks for any information,

-Dave


#2

jetskers wrote:

files with a link_to adjustment, as in
hit on the reverse proxy.

Thanks for any information,

-Dave

Since you’ll be using Apache you can have it do the work for you by
doing something like:

ProxyPass /rails http://127.0.0.1:3000/
ProxyPassReverse /rails http://127.0.0.1:3000/


Michael W.


#3

Well, yes, of course, and that’s what I’m doing.

But how do I tell applications in rails to write links that refer to
applications
written in rails to put in /rails in those url’s?


#4

Well, yes, of course, and that’s what I’m doing.

But how do I tell applications in rails to write links that refer to
applications
written in rails to put in /rails in those url’s?


#5

jetskers wrote:

Well, yes, of course, and that’s what I’m doing.

But how do I tell applications in rails to write links that refer to
applications
written in rails to put in /rails in those url’s?

If you are using Mongrel you can do it like this:

mongrel_rails start -d -p 3000
-a 127.0.0.1
-e production
–prefix /rails


Michael W.


#6

Well, yes, of course, and that’s what I’m doing.

But how do I tell applications in rails to write links that refer to
applications
written in rails to put in /rails in those url’s?


#7

oops… shouldn’t be hitting that reload button.