sjbttt sjbttt · Jan 21, 2019

How can I get the real IP Address?

My database service is on the cloud server, and I access it on the company intranet. When I user the %request.CgiEnvs  to get "REMOTE_ADDR", but what I have been getting is the company's external address. I can't get my IP address in the LAN. 
For example, my computer IP address is, and my company's external public network address is 214.17.17. I can only get 214.17.17 by using %request.CgiEnvs("REMOTE_ADDR"), but not   

I only want to get

Any help would be appreciated. Thanks!

3 0 6 704
Log in or sign up to continue

Looks like NAT. Cloud server only sees external address (214.17.17) as it should.

Why do you want to get internal address?

Because I want to manage the client through information such as IP address.

If you want, you can pass current IP as a header or inside the message body.

Do you want it for logging purposes, such as what actions were performed from which IP?

Yes, I want to record what actions were performed from which IP. The reason I wanted to find the answer at %Request was because I was bothered by another question. My application is B/S structure, the front-end is implemented by React, and the method of getting local IP address by Javascripts is incompatible with IE, Chrome, Firefox and so on. Because Chrome is not compatible with ActiveX. If I can, I want to get the IP address in a unified way, compatible with the browsers above.

2 solutions,1、use WCF provide resident local service for front-end call to obtain real local IP;2、encapsulate a browser provided method for the front end to call;      In fact, I used both, in different ways in different scenes