my php script has $_SERVER['HTTP_HOST'] is equals to an ip that has nothing to do with my server's ip.
Someone got an easy explanation?
(I was thinking some bot is sending a completly wrong Host header, but i don't think it can connect to a server with a wrong host header =/ )
thx
The
Host
header has absolutely nothing to do with connecting to the web server. It is used by the web server, once connected, to route the HTTP conversation to a particular virtual host. It may be that the virtual host your script is in is the default virtual host, in which case the HTTP conversation will be routed to it provided it doesn't match any other virtual hosts.HTTP_HOST
is provided by the client, in theHost:
part of the HTTP request. It can be changed arbitrarily, though I can't see why one would want to. See the manual page.Use
$_SERVER['SERVER_NAME']
instead. This is defined by the server itself.