简体   繁体   中英

Detect domain used to access EC2 instance behind Load Balancer

I am using AWS to host an EC2 instance. This instance uses a php application which would show different things depending on what domain is used to access the instance. For example, domain1.com and domain2.com both point to the same load balancer which sends the requests to the EC2 instance. 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.

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

I am not looking for the host name or ec2 domain.

$_SERVER['HTTP_HOST']将提供域,即使您在AWS上的负载均衡器后面也是如此。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM