I want to run a rails app behind a mod_proxied apache web server. So I
need to tell rails to create urls for the frontend web server instead of
the hostname:port (localhost:3000 in this case) it really is listening
on. I haven’t found a way to configure rails to do this.
I have hacked rewrite_url for a temporary fix like this atm:
module ActionController
class UrlRewriter
alias old_rewrite_url rewrite_url
you can have rails create your links without the host information…
You mean, I should use relative urls with absolute pathes? Yes, this
would be possible for the links. The situation is a bit more
complicated, though.
Actually I am trying to get typo (typo.leetsoft.com) to run from this
configuration, and they use url_for heavily. This could be a typo
problem, but I don’t think so, because rails trys to build the absolute
urls with the hostnames and fails to do it correctly in this setup. If
url_for isn’t intended to build the absolute urls, it shouldn’t try to
put in the hostnames in the first place. It should be either restricted
to only create relative urls with absolute pathes, or do it correctly.
In the case of typo it’s necessary to have absolute urls for the rss
feed creation. It is also necessary to create registrations emails with
click confirmation. It’s of course possbile to force application
developers to take care of adding hostnames and ports in front of the
absolute pathes, but shouldn’t rails make developing apps easier instead
of luring developers into introducing such errors in their apps?
Florian
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.