Forum: Ruby on Rails proxy, routes.rb, and urls

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.
A702dd81fc0ab87d71869b4feacccfda?d=identicon&s=25 jetskers (Guest)
on 2007-03-26 21:14
(Received via mailing list)
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
Dfd6f9989147955682701da8227df8b4?d=identicon&s=25 Michael Wang (Guest)
on 2007-03-26 22:32
(Received via mailing list)
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 Wang
A702dd81fc0ab87d71869b4feacccfda?d=identicon&s=25 jetskers (Guest)
on 2007-03-26 23:07
(Received via mailing list)
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?
Dfd6f9989147955682701da8227df8b4?d=identicon&s=25 Michael Wang (Guest)
on 2007-03-26 23:22
(Received via mailing list)
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 Wang
A702dd81fc0ab87d71869b4feacccfda?d=identicon&s=25 jetskers (Guest)
on 2007-03-26 23:37
(Received via mailing list)
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?
A702dd81fc0ab87d71869b4feacccfda?d=identicon&s=25 jetskers (Guest)
on 2007-03-27 00:13
(Received via mailing list)
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?
A702dd81fc0ab87d71869b4feacccfda?d=identicon&s=25 jetskers (Guest)
on 2007-03-27 00:44
(Received via mailing list)
oops... shouldn't be hitting that reload button.
This topic is locked and can not be replied to.