zendframework/zf2 — pull request #4581 by mbn18 (2013-06-03 20:50:36+00:00)
Title: Hostname route ignore HTTP_HOST and give SERVER_NAME precedence

Web servers that are configured to accept more then one name for a virtual host, pass the following variables:

SERVER_NAME - the virtual host __primary__ name
* In Apache -> __ServerName domain.com__ (other names under ServerAlias )
* In Nginx, the first value of: __server_name will-be-servername.com will-not-be-servername.com__

HTTP_HOST - the requested domain in the URL

As discussed with @DASPRiD, HTTP_HOST need to be checked first to verify what domain was asked by the client.

@weierophinney raised concern about the host header being spoofed. The Q is, even if so, do we have an alternative?

Extra info about the subject:
http://shiflett.org/blog/2006/mar/server-name-versus-http-host