[ZendTo] Re: Message to recipient showing IP Address instead of DNS name

Jules Jules at Zend.To
Sun Sep 5 15:09:01 BST 2010


  Do you need me to use HTTP_HOST or SERVER_NAME ?
I'm a bit lost...

In some places it uses one and some places the other. It makes no 
difference on my system, so I'm not sure which you want me to use.

Thanks,
Jules.

On 23/08/2010 18:59, Julian Field wrote:
> Thanks for this hint, I will change the code. It's a bit I didn't 
> write :-)
>
> -- 
> Jules
>
> On 21 Aug 2010, at 02:39 PM, Sergio Rabellino <rabellino at di.unito.it 
> <mailto:rabellino at di.unito.it>> wrote:
>
>> I have UseCanonical set to Off and the urls are constructed correctly 
>> with the FQDN name of my virtualhost.
>> As a reference:
>>
>>>
>>>       3.4.2. UseCanonicalName
>>>
>>>     UseCanonicalName/on|off/
>>>     Default: on
>>>     Server config, virtual host, directory, .htaccess
>>>
>>> This directive controls how Apache forms URLs that refer to itself, 
>>> for example, when redirecting a request for 
>>> /http://www.domain.com/some/directory/ to the correct 
>>> /http://www.domain.com/some/directory// (note the trailing "/" ). If 
>>> UseCanonical-Name is on (the default), then the hostname and port 
>>> used in the redirect will be those set by ServerName and Port. If it 
>>> is off, then the name and port used will be the ones in the original 
>>> request.
>>>
>>> One instance where this directive may be useful is when users are in 
>>> the same domain as the web server (for example, on an intranet). In 
>>> this case, they may use the "short" name for the server (/www/, for 
>>> example), instead of the fully qualified domain name 
>>> (/www.domain.com/, say). If a user types a URL such as 
>>> /http://www/somedir/ (without the trailing slash), then, with 
>>> UseCanonicalName switched on/,/ the user will be directed to 
>>> /http://www.domain.com/somedir//, whereas with UseCanonicalName 
>>> switched off, he or she will be redirected to /http://www/somedir//. 
>>> An obvious case in which this is useful is when user authentication 
>>> is switched on: reusing the server name that the user typed means 
>>> they won't be asked to reauthenticate when the server name appears 
>>> to the browser to have changed. More obscure cases relate to 
>>> name/address translation caused by some firewalling techniques
>>>
>>
>> How are you calling your server in the browser url ? If you use the 
>> IP, probably then you'll get the IP on the email.
>> Which browser/version are you using ?
>>
>> Into the lines you pinpointed, it's used $_SERVER['HTTP_HOST'] 
>> instead of $_SERVER['SERVER_NAME']: i agree with you, the second is 
>> better because it's related to the request's headers and not to the 
>> server configuration. I suggest Jules to exchange these as the values 
>> at the worst case are identical.
>>
>> hope this helps.
>>
>> Brad Beckenhauer ha scritto:
>>> Ok,  I'm no PHP kung-fu expert, but I'm pretty sure that I've 
>>> narrowed down where my problem is, but I'm not sure how to fix it or 
>>> if there is a better method.
>>> in /lib/NSSDropbox.php lines 40-43 appear to be what is extracting 
>>> the server name for the email message.  In my case it's always an IP 
>>> Address instead of the desired DNS host name.   I did abit of 
>>> research and found that if I set  "UseCanonical On" in the apache 
>>> conf file that $_SERVER['SERVER_NAME']; would return my server DNS name.
>>> I have a correct entry in my /etc/hosts file.
>>> What am I missing here to get the email to have the dns name instead 
>>> of the hostname?
>>> thanks
>>> Brad
>> ....
>> -- 
>> Ing. Sergio Rabellino
>>
>> Università degli Studi di Torino
>> Dipartimento di Informatica
>> ICT Services Director
>> Tel +39-0116706701  Fax +39-011751603
>> C.so Svizzera , 185 - 10149 - Torino
>>
>> <logo.jpg> <http://www.di.unito.it>
>>
>> _______________________________________________
>> ZendTo mailing list
>> ZendTo at zend.to <mailto:ZendTo at zend.to>
>> http://mailman.ecs.soton.ac.uk/mailman/listinfo/zendto
>
>
> _______________________________________________
> ZendTo mailing list
> ZendTo at zend.to
> http://mailman.ecs.soton.ac.uk/mailman/listinfo/zendto

Jules

-- 
Julian Field MEng CITP CEng
www.Zend.To

Need help fixing or optimising your systems?
Contact me!
Need help getting you started solving new requirements from your boss?
Contact me!

PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654
Follow me at twitter.com/JulesFM

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/zendto/attachments/20100905/6260d162/attachment.html 


More information about the ZendTo mailing list