how does request.host get set? Is there a way to manually set the
value in request.host?
I have several application servers running rails, each has its own
internal address in the request.host, so when calling redirect_to or
url_for function, it uses the internal address which is not accessible
to the user.
what I want is to set request.host to return mysite.com, no matter
which application server it's running on.
how does request.host get set? Is there a way to manually set the
value in request.host?
Probably based on environment variables passed through by whatever is
sitting in front of mongrel (assuming that's the setup you're using).
In something like nginx you can tell it to pass though various headers
eg:
proxy_set_header Host $http_host;
Thanks for the hints. I'm using apache & mongrel. I think I found
where it gets set, in the cgi_process.rb, apparently
env["HTTP_X_FORWARDED_HOST"] is used to get the host, in my case there
are 2 values, the public and the private address, it happens to take
the latter. now I need to find where HTTP_X_FORWARDED_HOST gets set.
it seems that it should be apache conf thing right?
Thanks for the hints. I'm using apache & mongrel. I think I found
where it gets set, in the cgi_process.rb, apparently
env["HTTP_X_FORWARDED_HOST"] is used to get the host, in my case there
are 2 values, the public and the private address, it happens to take
the latter. now I need to find where HTTP_X_FORWARDED_HOST gets set.
it seems that it should be apache conf thing right?