I use development Heroku account, and wrote simple web application. When I try to obtain RemoteAddr
from the HTTP Request, I get IP: 10.151.38.13:47253
, which is private address, and not my IP address shown from www.whatismyipaddress.com
for example. I understand that there is some proxy, relaying web traffic, but is it possible to get the real IP address.
Thank you.

- 534
- 8
- 19
-
1possible duplicate of [Get client's real IP address on Heroku](http://stackoverflow.com/questions/18264304/get-clients-real-ip-address-on-heroku) – James Emerton Apr 09 '15 at 22:08
2 Answers
No. The IP address will change and can't be guaranteed. Use a domain name. If you really need a static IP address, check out the proximo add-on.

- 4,498
- 22
- 24
-
This doesn't actually answer the question. OP asked whether it's possible to get the originating caller's IP address, not how to fix their own IP address. – jetsetter Aug 15 '22 at 15:31
I know this question is super old, but since it's near the top of the search result list I want to point anyone else who lands here to the correct answer.
See this StackOverflow post for a detailed discussion on the topic.
In short: yes, IPs can be spoofed, relayed, etc., and you should never really trust the end user. Setting that aside, the X-Forwarded-For
server variable will provide the best guess of the caller's IP address. The first (left-most) address in the list should be the actual caller's IP, while the last (right-most) address in the list will be whatever IP actually connected to Heroku to make the request. See the post I linked above for more details.
Note that using the REMOTE_ADDR
server variable will give you the IP of the Heroku router that connected to your dyno. This might be useful, but isn't what this question is looking for.

- 517
- 5
- 19