Friday, February 10, 2012

[Rails] My Host

I need to get some absolute redirects working -- basically I set callback hooks to external services, but I want these hooks to use my configured CNAME's.  I'm trying to find a way so that my app doesn't have to know about these CNAME's.  So I'm looking at the request in the controller to try and get the base URL where I'm running.

To test, I'm using localtunnel.  I have found what I'm looking for in 3 places, and I'm wondering if one is better than another or if one is more reliably set than another.

request.env["SERVER_NAME"]
request.host
request.env["HTTP_HOST"]

All three of these have the value I'm looking for (e.g. "3eym.localtunnel.com") .  Is there any difference between them?  Should I favor one over another?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/C3S2bsSAWicJ.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate