简体   繁体   English

检测用于访问负载均衡器后面的EC2实例的域

[英]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.

相关问题 EC2实例上的静态页面未在CloudFormation中的负载均衡器后面提供 - Static page on EC2 instance not served behind load balancer in CloudFormation 从 Load Balancer 后面访问 AWS EC2 Inte.net - AWS EC2 Internet access from behind Load Balancer 无法访问 AWS Application Load Balancer EC2 实例中的 HTTPs - Unable to Access HTTPs in AWS Application Load Balancer EC2 Instance EC2负载均衡器实例协议和端口 - EC2 Load Balancer Instance Protocol and Port 如何为负载均衡器后面的 AWS EC2 实例上的所有传出流量分配唯一的域名/IP - how to assign a unique domain name /IP to all outgoing traffic on AWS EC2 instances behind the load balancer 通过HTTPS和Load Balancer通过自己的域访问AWS EC2 Webserver - Access AWS EC2 Webserver over own Domain via HTTPS and Load Balancer Web部署到AWS Elastic Load Balancer后面的EC2实例 - Web Deploy to EC2 instances behind AWS Elastic Load Balancer 将WWW强制置于AWS EC2负载均衡器之后 - Force WWW behind an AWS EC2 Load Balancer 部署到负载均衡器后面的EC2实例; PHPStorm + GitHub - Deploying to EC2 instances behind a load balancer; PHPStorm + GitHub 如何保护网络负载均衡器后面的 EC2 实例? - How to protect EC2 instances behind a network load balancer?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM