Skip to content
Official X-Real-IP trust guarantees for Caddy behind Railway
egaelgomez
OP

19 days ago

Hello,

We are evaluating Railway for a new application with an HTTPS edge, a restricted Caddy gateway, and a private web service. We need a trustworthy client IP for authentication abuse controls. We have not deployed this architecture yet because we could not find sufficient official documentation confirming how Railway handles client-provided IP headers. Could you clarify the supported trust model and point us to the relevant documentation?

Specifically:

  1. Does Railway’s edge always replace an incoming X-Real-IP with the client IP it observes, or can client-supplied values be preserved or appended?
  2. How are duplicate headers, comma-separated values, and differently capitalized names handled across HTTP/1.1 and HTTP/2?
  3. How are conflicts with Forwarded, X-Forwarded-For, or other client-IP headers handled, and which value is authoritative?
  4. Are there documented, exclusive source CIDRs or an authenticated mechanism that Caddy can use to verify that an IP assertion came from Railway’s edge, rather than from a client or another private-network service? How are changes to that trust model communicated?

If available, please share the recommended Caddy trusted-proxy configuration. We are looking for a supported guarantee rather than the result of a single test request.

An AI assistant recommended contacting Railway because the documentation reviewed did not establish the required IP provenance. There is no affected Railway service or deployment yet; this is a pre-deployment architecture question.

Thank you.

Solved

1 Reply

Railway
BOT

19 days ago

For requests that come through our public HTTP edge, including .up.railway.app and custom domains, the edge overwrites X-Real-IP, X-Forwarded-For, X-Forwarded-Proto and X-Forwarded-Host. Any client-supplied copies are replaced, not kept or appended to. X-Real-IP is the client IP the edge observes and is the value to use for rate limiting. Public TLS ends at the edge, and the edge forwards HTTP/1.1 to your service, converting HTTP/2 when needed. One exception: if the connection comes from Cloudflare's published IPv4 ranges and carries CF-Connecting-IP, X-Real-IP is set from that header. The meanings of these headers are listed in our public networking specifications, which also say the details can change at any time.

We can't give you a guarantee about how the Forwarded header is handled, or about the handling of duplicate headers, comma-separated values and different capitalizations beyond the overwrite above. Don't treat any of those as authoritative.

There are no published or exclusive source CIDRs for the proxy addresses your container sees as its socket peer. An observed 100.64.0.0/10 address is not a stable range. There is also no signed or authenticated forwarding-header mechanism that Caddy can verify.

Requests over *.railway.internal don't pass through the edge or its header cleanup. Any service in the same project environment can reach Caddy's port and send its own forwarding headers. Configuring Caddy's trusted_proxies broadly therefore trusts every path to that listener, including other services in the environment and any TCP proxy. We can't recommend a Railway-specific CIDR for that setting.


Status changed to Awaiting User Response Railway • 19 days ago


Railway
BOT

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


Welcome!

Sign in to your Railway account to join the conversation.

Loading...