R
Railway4mo ago
iQuick

obtaining external ip address from docker container

I have deployed my app using docker on Railway, my app takes the external ip address from the requests it gets and needs to save them to a database. However when saving the address it's a private IP address and that's not what i want
Solution:
iQuick, please see the "request headers" section of this docs page https://docs.railway.app/reference/public-networking
Jump to solution
17 Replies
Percy
Percy4mo ago
Project ID: N/A
iQuick
iQuick4mo ago
okay i'll try that one
Brody
Brody4mo ago
nope
maddsua
maddsua4mo ago
what nope lol that's what railway's proxy sets
Brody
Brody4mo ago
not for long
Solution
Brody
Brody4mo ago
iQuick, please see the "request headers" section of this docs page https://docs.railway.app/reference/public-networking
maddsua
maddsua4mo ago
some of those were spoofable, weren't they?
Brody
Brody4mo ago
read the right most value railway is not going to be using envoy forever
maddsua
maddsua4mo ago
ok, true, but there was a problem with clients being able to just set arbitrary value to X-Forwarded-For
Brody
Brody4mo ago
^
maddsua
maddsua4mo ago
I didn't see any updates that it was fixed bruh it should be overwritten, not appended anyway, I'm out then
iQuick
iQuick4mo ago
so uh it can be spoofed
Brody
Brody4mo ago
^
iQuick
iQuick4mo ago
i'd say the right one is X-Forwarded-For i just need the remote ip
Brody
Brody4mo ago
read the right most value from that header and you will get the remote ip
iQuick
iQuick4mo ago
ok thanks it works, thank you
Brody
Brody4mo ago
no problem