On 10/9/06, Jon Rosebaugh <[EMAIL PROTECTED]> wrote:
>
> On 10/9/06, Shannon -jj Behrens <[EMAIL PROTECTED]> wrote:
> >
> > I need to redirect the user to a login server. I want to pass along
> > my complete current URL. url_for doesn't include the hostname.
> > What's the easiest (i.e. a single method call) way of getting the
> > complete current URL (i.e. it takes care of http vs. https, the port,
> > etc.)?
>
> What I do is piece it together from the stuff in the WSGI environment.
> But sometimes your app has no way of knowing, such as if you're
> running behind a proxy. In those cases, you really have to manually
> specify it.
Thanks for the help.
I use to have this code in Aquarium (before the WSGI days):
if env.has_key("HTTP_X_FORWARDED_HOST"):
host = env["HTTP_X_FORWARDED_HOST"]
That is, if there is a X_FORWARDED_HOST header, use that as your HOST
header. That way, the proxy issues go away.
Happy Hacking!
-jj
--
The one who gets the last laugh isn't the one who did the laughing,
but rather the one who did the writing.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pylons-discuss
-~----------~----~----~----~------~----~------~--~---