Reynard | 20 Jul 16:37
Picon

Re: how does request.host get set?


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?

- reynard

On Jul 20, 6:41 am, Frederick Cheung <frederick.che...@...>
wrote:
> On 20 Jul 2008, at 08:49, Reynard wrote:
>
>
>
> > 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;
>
> Fred
>
>
>
> > 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.
>
> > - reynard
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@...
To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe <at> googlegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---


Gmane