7 months ago
I'm experiencing an issue with custom domain routing for my service.
Service Details:
- Project: Connect service (Bun/Hono app)
- Railway URL: connect-production-ba24.up.railway.app - works correctly
- Custom domain: connect.gainable.dev - returns 502
Configuration:
- Port: 3000 (correctly set in custom domain settings)
- CNAME target: 007tej75.up.railway.app (DNS verified and resolving correctly)
- Custom domain shows "Setup complete" with green checkmark
What I've tried:
- Redeploying the service
- Removing and re-adding the custom domain
- Toggling the port setting (3001 → 3000) to force refresh
- Verified DNS is pointing to the correct Railway target
Behavior:
- curl https://connect-production-ba24.up.railway.app/health → {"status":"ok"}
- curl https://connect.gainable.dev/health → 502 "Application failed to respond"
The app is running correctly on the Railway URL, but the custom domain proxy doesn't seem to be routing to the service.
Request ID examples: V8Rk1rl0QNaV-9k0jUJq2g, 7V0kP10BTsmsvHclw9P4nw
Could you please check the routing configuration for this custom domain?
Thanks!
7 Replies
7 months ago
This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.
Status changed to Open brody • 7 months ago
7 months ago
Hey! I noticed your Railway URL is connect-production-ba24.up.railway.app but your CNAME is pointing to 007tej75.up.railway.app - those don’t match. Your CNAME should point to the same subdomain as your Railway service URL. Try updating your DNS to point to connect-production-ba24.up.railway.app instead. If that’s intentional (like pointing to a different service), then there might be a routing issue on Railway’s end and you’ll need staff to check the proxy config for those request IDs you provided.
7 months ago
I just follow the instructions when you create the custom domain; works for everything else - tried that too (connect-production-ba24.up.railway.app) didn't work either - see screenshot. The incorrect error you see below is from a previous try to set the custom domain. You can also see in the other screenshot that it says setup complete and that's pointing to 007tej75.up.railway.app - done the exact same process for a couple of other deploys; and they work - but for some reason this one doens't.
7 months ago
I think it's a routing issue on Railway’s end and need staff to check the proxy config.
7 months ago
Nothing wrong on our end, this would be a misconfiguration, so I'll let the community help you with it!
7 months ago
Could you solve this? 🙂
4 months ago
4 months ago
thanks for the detailed report!
Since your Railway URL (connect-production-ba24.up.railway.app) returns a healthy response but your custom domain (connect.gainable.dev) returns a 502, the issue is almost certainly in the proxy/routing layer between your custom domain and your service — not in your app itself.
A few things to check and try:
1. Verify the CNAME target matches your service
You mentioned the CNAME points to 007tej75.up.railway.app — make sure this is the target Railway assigned specifically for your custom domain, not a different service's target. You can confirm this in your service's Settings → Custom Domains section.
2. Check for multiple services in the project
If you have more than one service in this project, ensure the custom domain is attached to the correct service (the one running on port 3000). A 502 "Application failed to respond" can occur when the domain is routed to a service that isn't listening on the expected port.
3. Confirm the PORT environment variable
Make sure your app binds to 0.0.0.0:3000 (not 127.0.0.1:3000 or localhost:3000). While this typically causes issues on the Railway URL too, it's worth double-checking.
4. Remove and re-add with a fresh DNS flush
Try this sequence:
Remove the custom domain from Railway
Delete the CNAME record from your DNS provider
Wait a few minutes for propagation
Re-add the custom domain in Railway and set up the new CNAME target provided
5. Check for a CDN or proxy in front
If you're using Cloudflare or another proxy/CDN in front of your DNS, try setting the DNS record to DNS only (grey cloud in Cloudflare) rather than proxied. Proxied mode can interfere with Railway's TLS termination and routing.
If none of the above resolves it, sharing the request IDs you provided (V8Rk1rl0QNaV-9k0jUJq2g, 7V0kP10BTsmsvHclw9P4nw) with Railway support directly would help them trace the routing path on their end.