Is the server variable HTTP_HOST always defined for all servers, or for example in IIS is defined with other name or even is not defined at all?
Also, that value is always defined? Or some host they don’t define that value? Is there any other way to retrieve that value?
Quoting the manual
HTTP_HOST is
HTTP_HOST is a part of the client’s HTTP request and specifies which host name the request is to be directed to. if HTTP_HOST is not set, the client is either very, very old (HTTP 1.0 doesn’t support HTTP_HOST) or has made a request directly to your web site’s IP.
I think the Host HTTP Header is mandatory since HTTP 1.1