a month ago
Hello Railway Team,
I'm deploying a FastAPI/Uvicorn application on Railway. HTTPS terminates at Railway's edge, and traffic is forwarded to the container over HTTP.
Our application requires a trustworthy HTTPS scheme before allowing authenticated requests. We want to configure this securely without trusting arbitrary client-supplied forwarding headers.
Could you please clarify:
-
Does Railway's public edge overwrite or reject client-supplied
X-Forwarded-Proto,X-Forwarded-Host, andForwardedheaders, including duplicate or conflicting values? -
Is there a supported way for an application to distinguish traffic coming through Railway's public edge from requests arriving directly through private networking?
-
Does Railway provide a stable trusted proxy IP range or another reliable way to authenticate the forwarding proxy?
-
What is the recommended secure configuration for FastAPI/Uvicorn to recognize the original HTTPS scheme without using
--forwarded-allow-ips='*'?
We are requesting clarification of Railway's networking and security behavior before enabling authentication and database access.
Thank you!
1 Reply
a month ago
Our public HTTP edge overwrites X-Forwarded-Proto, X-Forwarded-Host, X-Forwarded-For and X-Real-IP, replacing any copies the client sent instead of keeping or appending them. For requests through the edge, X-Forwarded-Proto is set to https and X-Forwarded-Host to the original host. Base your scheme check on X-Forwarded-Proto, not Forwarded.
Requests made directly over *.railway.internal do not pass through the edge, so their headers are not cleaned. Any service in the same project and environment can reach your listening port and send its own forwarding headers. An application cannot reliably tell edge traffic from private traffic using headers, and we have no signed-header or mTLS mechanism that proves a request came through the edge. Private networks are isolated between projects and environments, so services within one environment share a trust boundary.
We do not publish a stable proxy IP range. The 100.64.0.0/10 address you may see as the socket peer is not guaranteed and can change, so do not hard-code it as a trusted proxy range.
For Uvicorn, --forwarded-allow-ips='*' trusts every immediate peer. That is only safe if you accept everything inside the environment as trusted, and you also run no TCP proxy or other ingress path to the same port. Public TLS ends at the edge, and the hop from the edge to your container runs over an encrypted WireGuard tunnel, the same transport private networking uses. See the public networking specs.
Status changed to Awaiting User Response Railway • about 1 month ago
23 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 • 23 days ago