Suppose your server is at10.10.50.1,and the public IP is 8.8.8.8.
Suppose your client is at10.10.50.100-199, and the IP of the public network is 4.4.4.4.
If your client accesses in the form of public network, such as http://8.8.8.8/ip.php,, the IP obtained by the server is 4.4.4.4.
On the other hand, if you visit in the form of an intranet, such as http:/10.10.50.1/ip.php, the IP you get is10.50.1.
The solution is either to use the intranet address to access, or to set the routing designation 10.10.50.100-199 to access, instead of taking the public network, take the10 network segment.