简体   繁体   中英

Javascript - Get external IP address from request made on localhost

I am currently in the process of developing a feature that that calls out to an external service to get location information based on the client's IP.

In my express node server, I am pulling the ip with req.ip , which from what I've read elsewhere is the correct way to do it. However, because I am running the server / client locally, the IP address on the request is my local host.

Is there anyway to make the request from my client, which is running locally, to put my external IP into the request so I can validate that my full feature is working properly?

Connect to your server with your public IP rather than localhost

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