502 gateway bad - website never went up why?
kingjazz22
PROOP

14 days ago

"Custom domain returns 502 with X-Railway-Fallback: true. Service works fine at victor-jazz-website-production.up.railway.app. Domain shows green/verified in Settings → Networking → Port 3000. CNAME n38ikghi.up.railway.app resolves correctly, TXT record verified. Deleted and re-added domain, redeployed multiple times — still 502."

1 Replies

matanzisman
HOBBY

14 days ago

Most likely cause: custom domain target port ≠ app listen port

You said the custom domain is bound to port 3000. If the app actually listens on Railway’s injected PORT (often 8080 or similar), the auto domain works but the custom domain 502s.

Attempt -

Open victor-jazz-website → Deployments → latest → View logs

Find the line like Ready on http://0.0.0.0:XXXX (Next.js) or check what port nginx/node binds to

In Settings → Networking → your custom domain → Edit, set the target port to that exact port

Or remove the explicit target port so Railway uses the service PORT variable

Railway’s own docs use this exact example: custom domain set to 3000 while the app listens on 8080 → 502.


Welcome!

Sign in to your Railway account to join the conversation.

Loading...