X-Real-IP showing our Google LB's IP instead of Client's IP
kritop
PROOP

a month ago

We have a Google Cloud Loadbalancer running in front of our NextJS Railway project. I can see that Railway uses its own LB/Routing via Fastly. it seems Fastly is picking the wrong X-Real-IP, its picking up our LBs IP instead of the Clients.

What Headers do we have to set on our LB so its working as expected? X-Forwarded-For seems to work as expected showing the whole chain of IPs.

Solved

7 Replies

Railway
BOT

a month ago

Our edge proxy sets X-Real-IP to the immediate connecting IP, which in your case is your Google Cloud Load Balancer. This is expected behavior when placing another proxy/LB in front of Railway. Since X-Forwarded-For correctly contains the full chain of IPs, you can extract the original client IP from the first entry in that header within your application instead of relying on X-Real-IP.


Status changed to Awaiting User Response Railway about 1 month ago


kritop
PROOP

a month ago

I am not worried about our application not working accordingly I am more worried that Fastly/Railways infrastructure is routing traffic wrongly because its not by design working behind a LoadBalancer.


Status changed to Awaiting Railway Response Railway about 1 month ago


a month ago

You can see a real example of the available headers here - https://utilities-us-east.up.railway.app/raw


Status changed to Awaiting User Response Railway about 1 month ago


kritop
PROOP

a month ago

i can see them in our application too or did you wanna point out something?


Status changed to Awaiting Railway Response Railway about 1 month ago


a month ago

Then it sounds like I can mark this as solved, unless I am not understanding the problem here?


Status changed to Awaiting User Response Railway about 1 month ago


kritop
PROOP

a month ago

we are wondering if railways routing or any other networking feature is not working correctly since it cant identify the clients actual ip and origin.


Status changed to Awaiting Railway Response Railway about 1 month ago


a month ago

Neither Fastly nor our routing depends on the clinet IP.


Status changed to Awaiting User Response Railway about 1 month ago


Railway
BOT

a month ago

This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!

Status changed to Solved Railway 26 days ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...