[英]Detect domain used to access EC2 instance behind Load Balancer
I am using AWS to host an EC2 instance. 我正在使用AWS托管EC2实例。 This instance uses a php application which would show different things depending on what domain is used to access the instance.
该实例使用一个php应用程序,该应用程序将显示不同的内容,具体取决于用于访问该实例的域。 For example, domain1.com and domain2.com both point to the same load balancer which sends the requests to the EC2 instance.
例如,domain1.com和domain2.com都指向同一负载平衡器,该负载平衡器将请求发送到EC2实例。 I would like to know if the client is using domain1.com or domain2.com to access the instance so that I could show a different text or logo.
我想知道客户端是使用domain1.com还是domain2.com来访问实例,以便可以显示不同的文本或徽标。
I checked X-Forwarded headers but they only seem to give me the clients ip http://docs.aws.amazon.com/elasticloadbalancing/latest/classic/x-forwarded-headers.html 我检查了X-Forwarded标头,但它们似乎只给我客户端ip http://docs.aws.amazon.com/elasticloadbalancing/latest/classic/x-forwarded-headers.html
I am not looking for the host name or ec2 domain. 我不是在寻找主机名或ec2域。
$_SERVER['HTTP_HOST']
将提供域,即使您在AWS上的负载均衡器后面也是如此。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.