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

Brad Beckenhauer bbecken at aafp.org
Mon Aug 23 14:51:25 BST 2010


hello Sergio,

>>> On 8/22/2010 at 2:56 PM, in message <4C7180E9.1090704 at di.unito.it>, Sergio Rabellino <rabellino at di.unito.it> wrote:


Brad Beckenhauer ha scritto: 
Hi Sergio,
Right now I'm calling the server using dns name in the browser URL (Canonical is off and apache restarted).
I've tested using Firefox 3.6.8 and IE 8 and in both cases I get the private IP Address in the message sent to the user.

I then changed the line $_SERVER['HTTP_HOST'] to read $_SERVER['SERVER_NAME'] and I still get the IP Address in the email with canonical OFF.


this is awesome, did you verify that servername is defined as fdqn for the apache you're calling (i don't know if it's a virtualhost) ?


I'm not running as a virtual host (Julian's vm package does not have it enabled) and the only settings I've changed in the Apache httpd.conf file are the ServerName and the UseCanonicalName as shown below (NameVirtualHost is remarked out).

ServerName host.domain.tld:80
UseCanonicalName On

for now on the production box, I'm going to leave "CanonicalName On" in the Apache host and change line 40 in the lib/NSSDropbox.php 
from:
$NSSDROPBOX_URL = "http".($_SERVER['HTTPS'] ? "s" : "")."://".$_SERVER['HOST_NAME'].$_SERVER['REQUEST_URI'];

to:
$NSSDROPBOX_URL = "http".($_SERVER['HTTPS'] ? "s" : "")."://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];

I'll continue to try and figure out why I have to enable the Canonicalname.
-Brad


If I turn "Canonical On" and change the line $_SERVER['HTTP_HOST'] to read $_SERVER['SERVER_NAME'], then the email correctly sends the host DNS name and not the IP Address..

no ideas for now....


Are you using the Centos-64 vm from Julian as well?


no i've my "ancient" server on a solaris box, but damn, apache is apache and php is php... (btw i've also a service on a centos-64 with apache/php with the same behaviour)

Thanks you for your help!
Brad



>>> Sergio Rabellino 08/21/10 8:45 AM >>>
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

 

_______________________________________________
ZendTo mailing list
ZendTo at zend.to
http://mailman.ecs.soton.ac.uk/mailman/listinfo/zendto


-- 

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

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/zendto/attachments/20100823/26c8d1ca/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 4167 bytes
Desc: not available
Url : http://mailman.ecs.soton.ac.uk/pipermail/zendto/attachments/20100823/26c8d1ca/attachment.jpe 


More information about the ZendTo mailing list