Use SERVER_NAME instead of HTTP_HOST since it is more reliable