In PHP, the standard way to get the user’s IP address is from the $_SERVER[‘REMOTE_ADDR’] variable. Unfortunately, that doesn’t work on our main webserver. That’s because that server is really several servers sitting behind a special server called a load-balancer. When anyone goes to wou.edu, they are really going to the load-balancer, which hands off the request to one of the actual webservers. This is a fairly common setup in the web world, because it means the whole website will no longer go down if a single webserver fails.
Unfortunately, there’s a drawback. Because of some peculiarities of our network setup, when the load-balancer passes a request to one of our webservers, that server sees the load-balancer’s IP address instead of the actual user’s. If you code in PHP on our server, you may have noticed that $_SERVER[‘REMOTE_ADDR’] always has one of four specific IP addresses. (Though you might expect only one from my oversimplified description just now.)
Luckily, we now have a workaround. Dave McEvilly figured out how to have the load-balancer include the user’s actual IP in a new, custom variable when it hands the request to whichever actual webserver it chooses. So the normal ‘REMOTE ADDR’ variable still has one of those same four addresses, but you can use $_SERVER[‘HTTP_WOU_REAL_IP’] to get the IP of the user who made the actual request.
I know this was a pretty technical post, but as always you can contact me with questions at swartzer@wou.edu.
It’s already added to the standard template, so after you have called the topinclude file, you can
I would like to hide IP of my site for local visitors, is there a PHP code that I can use for location?
Can you tell me, I am also interested to hide my website ip for local visitors.
good info, i try the best
Thx good info, i try the best
Excelente post, muy útil 👍
very Informative Blog
Visit our digital marketing website
This is a good blog that I look forward to reading. You guys always do a good job in writing blogs.
Digital Marketing Agency helps you promote your business at a very reasonable cost.
TAnaman INvestasi MAsa Kini
Awesome thanks!
Awesome post! Check out salon appointment software