obtaining external ip address from docker container
Anonymous
TRIALOP

2 years ago

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

Solved

26 Replies

maddsua
HOBBY

2 years ago

Check "x-envoy-external-address" request header for it


Anonymous
TRIALOP

2 years ago

okay


Anonymous
TRIALOP

2 years ago

i'll try that one


brody
EMPLOYEE

2 years ago

nope


maddsua
HOBBY

2 years ago

what nope lol


maddsua
HOBBY

2 years ago

that's what railway's proxy sets


brody
EMPLOYEE

2 years ago

not for long


brody
EMPLOYEE

2 years ago

please see the "request headers" section of this docs page

https://docs.railway.app/reference/public-networking


Status changed to Solved Railway almost 2 years ago


maddsua
HOBBY

2 years ago

some of those were spoofable, weren't they?


brody
EMPLOYEE

2 years ago

read the right most value


brody
EMPLOYEE

2 years ago

railway is not going to be using envoy forever


maddsua
HOBBY

2 years ago

ok, true, but there was a problem with clients being able to just set arbitrary value to X-Forwarded-For


brody
EMPLOYEE

2 years ago

^


maddsua
HOBBY

2 years ago

I didn't see any updates that it was fixed


maddsua
HOBBY

2 years ago

bruh


maddsua
HOBBY

2 years ago

it should be overwritten, not appended


maddsua
HOBBY

2 years ago

anyway, I'm out then


Anonymous
TRIALOP

2 years ago

so uh


Anonymous
TRIALOP

2 years ago

it can be spoofed


brody
EMPLOYEE

2 years ago

^


Anonymous
TRIALOP

2 years ago

i'd say the right one is X-Forwarded-For


Anonymous
TRIALOP

2 years ago

i just need the remote ip


brody
EMPLOYEE

2 years ago

read the right most value from that header and you will get the remote ip


Anonymous
TRIALOP

2 years ago

ok thanks


Anonymous
TRIALOP

2 years ago

it works, thank you


brody
EMPLOYEE

2 years ago

no problem


Loading...