[ZendTo] Re: Message to recipient showing IP Address instead of DNS name
Brad Beckenhauer
bbecken at aafp.org
Sun Aug 22 14:31:06 BST 2010
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.
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..
Are you using the Centos-64 vm from Julian as well?
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
correctlywith 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 URLsthat refer to itself, for example, when
redirecting a request for http://www.domain.com/some/directory to
thecorrect http://www.domain.com/some/directory/(note the trailing "/"
). If UseCanonical-Nameis on (the default), then the hostname andport
used in the redirect will be those set by ServerNameand 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 beuseful is when users are in
the same domain as the web server (forexample, on an intranet). In this
case, they may use the "short" namefor the server (www, for example),
instead ofthe 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 UseCanonicalNameswitched on, theuser 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 whichthis is useful is when user authentication is switched on:
reusing theserver name that the user typed means they won't be asked
toreauthenticate when the server name appears to the browser to
havechanged. More obscure cases relate to name/address translation
causedby 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'] insteadof
$_SERVER['SERVER_NAME']: i agree with you, the second is betterbecause
it's related to the request's headers and not to the
serverconfiguration. I suggest Jules to exchange these as the values at
theworst 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'venarrowed down where my problem is, but I'm not
sure how to fix it or ifthere is a better method.
in /lib/NSSDropbox.php lines 40-43 appear to be what isextracting the
server name for the email message. In my case it'salways an IP Address
instead of the desired DNS host name. I did abitof research and found
that if I set "UseCanonical On" in the apacheconf 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 nameinstead 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/zendto/attachments/20100822/a8a06b0f/attachment.html
More information about the ZendTo
mailing list