[ZendTo] Re: Message to recipient showing IP Address instead of DNS name
Sergio Rabellino
rabellino at di.unito.it
Sun Aug 22 20:56:25 BST 2010
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) ?
> 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
>
> <http://www.di.unito.it>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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
<http://www.di.unito.it>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/zendto/attachments/20100822/38193a57/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: logo.jpg
Type: image/jpeg
Size: 4167 bytes
Desc: not available
Url : http://mailman.ecs.soton.ac.uk/pipermail/zendto/attachments/20100822/38193a57/attachment-0001.jpg
More information about the ZendTo
mailing list