x-forwarded-for and x-real-ip 127.0.0.1

ralyodio
HOBBY

a month ago

The issue is that Railway's load balancer is not properly forwarding the real client IP. The problem is that Railway is setting x-forwarded-for and x-real-ip to 127.0.0.1, which means Railway's load balancer is not configured to pass through the real client IP.

Solved

0 Replies

ralyodio
HOBBY

a month ago

i think load balancer is not passing proper headers for real-ip


ralyodio
HOBBY

a month ago

 [IP-DEBUG] Direct connection: 127.0.0.1
šŸ” [IP-DEBUG] Found proxy headers: { xff: '127.0.0.1', real: '127.0.0.1' }
āœ… [IP-DEBUG] Using x-real-ip: 127.0.0.1
🌐 [HTTP-REQUEST] GET / - IP: 127.0.0.1 - UA: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36
šŸ“” [PROXY-HEADERS] { 'x-forwarded-for': '127.0.0.1', 'x-real-ip': '127.0.0.1' }
āœ… [HTTP-RESPONSE] GET / - 200 - 1596ms

ralyodio
HOBBY

a month ago

i need to get user's ip address somehow


ralyodio
HOBBY

a month ago

using Dockerfile to deploy



ralyodio
HOBBY

a month ago

not working for me for some reason


a month ago

That would be an issue with your application or configuration. I will let the community assist with that.


ralyodio
HOBBY

a month ago

are you using docker?


a month ago

Yes, though that is not applicable.


ralyodio
HOBBY

a month ago

I'm u sing Docker -> nginx -> proxy (node app). and i always get 127.0.0.1


a month ago

That would be an issue with your application or configuration.


a month ago

x-forwarded-for and x-real-ip 127.0.0.1


ralyodio
HOBBY

a month ago

ok


ralyodio
HOBBY

a month ago

i see the issue


ralyodio
HOBBY

a month ago

real-ip had two ips


ralyodio
HOBBY

a month ago

x-forwarded-for "76.236.30.220, 100.64.0.3"


ralyodio
HOBBY

a month ago

x-real-ip "100.64.0.3"

this must be the load balancer ip


a month ago

The first IP here is the user's IP


a month ago

The other IP's are the proxies it went through


ralyodio
HOBBY

a month ago

ok


a month ago

!s


Status changed to Solved medim • about 1 month ago


Loading...
x-forwarded-for and x-real-ip 127.0.0.1 - Railway Help Station