2005/11/30, Gregory (Grisha) Trubetskoy <[EMAIL PROTECTED]>:

On Wed, 30 Nov 2005, Jorey Bump wrote:

> Nicolas Lehuen wrote:
>
>> 2) Server name
>>
>> Thanks to Daniel's excellent posts, I can see that req.hostname is the
>> best way to get the server name so far. Unfortunately, it depends on data
>> sent by the client, but hey, so does the rest of the request handling ;).
>
> req.server.server_hostname is unambiguous, and I can't think of a real-world
> situation in which it would be None. It matches the ServerName in your Apache
> configuration, so won't this be a reliable value to use when reconstructing
> an URL?

To add just a tad more confusion here - don't forget ServerAlias, which is
also a perfectly valid value for the "deduced" URL. ;-)

Grisha

Exactly ! I was beginning to feel cornered into abandoning my mass virtual hosting setup, but it's clear that whenever anyone uses ServerAlias, he'll have the same problem, namely knowing what the request was in the first time. So I'll stick with req.hostname for now.

Regards,
Nicolas

Reply via email to