18 days ago
For an ASGI/Uvicorn backend behind Railway public HTTPS networking, what officially supported configuration establishes that a request originally arrived over HTTPS via X-Forwarded-Proto, without manually maintaining proxy IP addresses?
Please clarify how Railway overwrites or removes client-supplied X-Forwarded-Proto and Forwarded headers, including duplicate values, and how the backend can distinguish trusted edge-forwarded traffic from direct connections that could bypass the proxy. We need a documented trust boundary that prevents external clients from forging the original scheme, rather than trusting headers from every source.
The public networking specifications say X-Forwarded-Proto always indicates https and inbound public traffic requires TLS. Which supported application/network configuration makes relying on that guarantee safe? Please link the authoritative documentation or escalate for confirmation if this is not documented.
Platform-level question only; service N/A. No infrastructure changes, logs, private identifiers, credentials or attachments are needed.
1 Reply
18 days ago
Our HTTP edge overwrites X-Forwarded-Proto, along with X-Real-IP, X-Forwarded-For and X-Forwarded-Host, on every request that comes through a public domain, including .up.railway.app domains. Any copy the client sends, duplicates included, is replaced rather than kept or appended to, so a client going through the edge cannot forge the scheme. Public TLS is terminated at the edge, which is why the public networking specifications list X-Forwarded-Proto as https. That overwrite covers only those four headers, so your app should read X-Forwarded-Proto and not use Forwarded.
We do not publish a stable range for the proxy addresses your container sees as the socket peer, so don't hard-code an observed address as a trusted-proxy list. With Uvicorn, --proxy-headers plus --forwarded-allow-ips="*" trusts the headers from every immediate peer. That is safe only if every route to your listening port is trusted.
Two routes skip the edge's header rewriting. Other services in the same project and environment can reach your port directly over private networking and send their own headers. A TCP proxy passes raw bytes through without touching them. Private networks are isolated between projects and environments, so the trust boundary is the public edge plus the services in that environment. To rely on the scheme guarantee, don't add a TCP proxy to the service and only run trusted services in that environment. We don't offer a signed forwarding header or client-certificate identity that lets the app check a request came from the edge.
Status changed to Awaiting User Response Railway • 18 days ago
10 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 • 10 days ago