9 days ago
Hi Railway community,
We are experiencing an intermittent timeout issue with a custom domain connected to a Railway project.
The Railway-provided domain works correctly and remains accessible, but the custom domain intermittently times out. The strange part is that after redeploying the Railway service, the custom domain starts working again.
The custom domain is managed through Cloudflare. Both the root domain and the www subdomain are configured as CNAME records pointing to the Railway service domain.
Cloudflare configuration summary:
- DNS records are configured as CNAMEs pointing to the Railway-provided service domain.
- SSL/TLS mode is set to Full.
- Universal SSL is active.
- Both the root domain and
wwwsubdomain are added in Railway as custom domains. - Cloudflare proxy has been enabled, although we have also tested DNS only.
Important observations:
- The Railway-provided domain stays accessible.
- The custom domain intermittently times out.
- The issue seems more frequent when Cloudflare proxy is enabled.
- Switching the root domain to DNS only appeared to make it more stable.
- Redeploying the Railway service makes the custom domain work again.
- We do not see an obvious application crash, but we are still checking logs and metrics.
This makes us wonder if the issue could be related to Railway custom domain routing, Cloudflare proxy detection, certificate/domain mapping, or some stale routing state that gets refreshed after redeploying.
Has anyone experienced something similar with Railway custom domains behind Cloudflare?
Is there a recommended setup for Cloudflare + Railway custom domains to avoid intermittent timeouts, especially for the root domain and www subdomain?
Any guidance would be appreciated.
Thank you.
Pinned Solution
9 days ago
maybe try to switch both root and www to DNS only (grey cloud) in Cloudflare and rely on Railway's built-in Fastly protection. If you specifically need Cloudflare features (WAF rules, Workers, page rules etc.), keep the proxy on but be aware you're stacking two CDNs and intermittent issues are expected there isn't really a config that fully eliminates it on Railway's end right now
Also worth double-checking while you're in there:
- SSL/TLS mode is Full (not Full Strict) — Full Strict will fail intermittently during Railway cert renewals
- No CNAME flattening tricks on the root (a plain CNAME at apex via Cloudflare is fine, but make sure it's not also resolving via an old A record)
- Target port in Railway matches what your app listens on
2 Replies
Status changed to Open Railway • 9 days ago
9 days ago
Update:
We are also using UptimeRobot, and it reports the domain as continuously up. However, several real users from our region are getting timeouts from different networks, including home WiFi and 4G.
The Railway-provided domain remains accessible when this happens.
This makes us think it may not be a full outage, but possibly a regional routing issue, Cloudflare edge issue, Cloudflare proxy interaction with Railway, or intermittent custom domain routing problem.
When we switch the custom domain to DNS only in Cloudflare, it appears to become more stable.
Has anyone seen this behavior where UptimeRobot reports UP, but real users from certain networks get timeouts on a Railway custom domain behind Cloudflare?
9 days ago
maybe try to switch both root and www to DNS only (grey cloud) in Cloudflare and rely on Railway's built-in Fastly protection. If you specifically need Cloudflare features (WAF rules, Workers, page rules etc.), keep the proxy on but be aware you're stacking two CDNs and intermittent issues are expected there isn't really a config that fully eliminates it on Railway's end right now
Also worth double-checking while you're in there:
- SSL/TLS mode is Full (not Full Strict) — Full Strict will fail intermittently during Railway cert renewals
- No CNAME flattening tricks on the root (a plain CNAME at apex via Cloudflare is fine, but make sure it's not also resolving via an old A record)
- Target port in Railway matches what your app listens on
Status changed to Solved brody • 7 days ago