I'm creating web app with EC2, using Load balancer and ACM to get https at Application Load balancer layer, load balancer and EC2 connect with port 80. Server is Apache, code with Laravel. Networking look like Ok, I created an Ip filter layer to set limit access to admin control panel. I dont know why but sometime my access Ip changed when pass load balancer. For example I checked My Ip and got 125.9.4.168 but when I dump in Laravel code, It return 172.31.34.117. I don't know why but It's very strange. Some body know why? Thank you!
Asked
Active
Viewed 67 times
2 Answers
1
The 125.9.4.168 IP address is your public IP, and the 172.31.34.117 is the private address.
IPs beginning in 10, 172, and 192.168. are all private addresses.
See Wikipedia's private network article for more information. https://en.m.wikipedia.org/wiki/Private_network
Hope this helps.

GokuMizuno
- 493
- 2
- 5
- 14
-
when I didn't use load balancer and direct point domain name to Elastic IP, It was Ok and always return public Ip. Maybe I have to change php code to get public Ip. Thank you! – AkiHizashi Dec 08 '19 at 10:42
0
I found an article that same with my problem. Because my app under Load balancer so use Laravel User Agent to get Ip, Ip was returned with private Ip.

AkiHizashi
- 125
- 2
- 11