Supported trust model for client IP headers behind Railway HTTP ingress
ff66678
HOBBYOP

a month ago

Hello Railway community and team,

I am looking for the supported security contract for obtaining a client's IP address behind Railway's public HTTP ingress. The public networking specification documents X-Real-IP, but I have not found a complete description of its trust boundary.

Could you clarify:

  1. Is X-Real-IP always overwritten by Railway ingress with the actual remote client IP, including when a client sends its own X-Real-IP header?
  2. How does ingress handle a client-supplied X-Forwarded-For header: overwrite or append, and what does the resulting chain contain?
  3. Are there authoritative, stable source CIDRs for the proxies that directly connect to an application? If so, are those sources exclusive to Railway ingress, and where is the maintained list?
  4. If fixed proxy CIDRs are not a supported contract, what supported mechanism should an application use to authenticate the client-IP metadata supplied by ingress, including after restarts, scaling, or region changes?

This is a general platform question. No account identifiers, service details, logs, tokens, or end-user data are included. A link to the relevant official documentation would be helpful.

Thank you.

Solved$10 Bounty

4 Replies

Railway
BOT

a month ago

This thread has been opened as a bounty so the community can help solve it.

Status changed to Open Railway • 26 days ago


X-Real-IP and X-Forwarded-For is overwritten by Railway at the edge.

For proxies, it’s 100.0.0.0/8. (https://docs.railway.com/guides/spa-routing-configuration#option-1-caddy-recommended)


ff66678
HOBBYOP

a month ago

Thank you. I found the official Caddy example with trusted_proxies static private_ranges 100.0.0.0/8. To clarify the remaining part of the original question: is 100.0.0.0/8 an authoritative, stable range for the proxies that directly connect to application containers, and are those peers exclusive to Railway ingress (rather than reachable by other customer workloads)? Also, when both headers are overwritten, does X-Forwarded-For contain only the original client's address or a documented proxy chain? This is for validating the immediate TCP peer before trusting the client-IP header; no service-specific details are needed.


svetislav233
HOBBY

23 days ago

I ran an isolated staging test that appears to contradict the claim that X-Real-IP is always overwritten.

The application used one process and disabled automatic proxy-header rewriting. Eleven rapid login requests with a different caller-supplied X-Real-IP on every request all passed the per-client limiter. After allowing the fixed window to clear, the same test without a caller-supplied header correctly returned 429 on request 11.

This indicates that the caller-supplied X-Real-IP affected the application’s limiter identity, while Railway’s normal header provided a stable identity.

Could someone from Railway confirm:

Whether X-Real-IP and X-Forwarded-For are guaranteed to be overwritten at the edge;

Whether the Caddy example’s private_ranges 100.0.0.0/8 is an authoritative and exclusive ingress-proxy trust boundary;

Which header and trust configuration Railway recommends for non-Caddy applications such as FastAPI/Uvicorn???


ff66678

Thank you. I found the official Caddy example with `trusted_proxies static private_ranges 100.0.0.0/8`. To clarify the remaining part of the original question: is 100.0.0.0/8 an authoritative, stable range for the proxies that directly connect to application containers, and are those peers exclusive to Railway ingress (rather than reachable by other customer workloads)? Also, when both headers are overwritten, does X-Forwarded-For contain only the original client's address or a documented proxy chain? This is for validating the immediate TCP peer before trusting the client-IP header; no service-specific details are needed.

23 days ago

100.0.0.0/8 is not guaranteed to be stable.


Status changed to Awaiting Railway Response Railway • 23 days ago


Status changed to Awaiting User Response Railway • 23 days ago


Railway
BOT

16 days 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 • 16 days ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...