Railway Application Failed to Respond (502)
Quick answer
Railway's edge proxy cannot reach your app, so it returns a 502. Most often the app is not listening on host 0.0.0.0 and the PORT variable, or the domain's target port is wrong.
Most likely fix: Correct the target port
How to fix it
Try these in order — the most common fix is first.
1. Correct the target port
- Open your service settings and find the public domain
- Set the target port to the port your app actually listens on (for example 8080 instead of 3000)
- Redeploy and reload the domain
Did this fix it?2. Bind to 0.0.0.0 and the PORT variable
- Railway injects PORT automatically; read it from the environment
- Node/Express: app.listen(process.env.PORT || 3000, '0.0.0.0')
- Next.js: next start --port ${PORT-3000}
- Uvicorn: uvicorn main:app --host 0.0.0.0 --port $PORT
- Gunicorn binds to 0.0.0.0 and PORT by default
Did this fix it?3. Check for overload
- Open the Metrics tab of the service and look at CPU
- Node.js peaking near 1 vCPU suggests it is saturated
- Add replicas in one or more regions to scale horizontally
Did this fix it?
Symptoms
Visiting your Railway domain shows 'Application failed to respond' with a 502 Bad Gateway status, even though the deploy shows as successful.
Why it happens
- App not listening on host 0.0.0.0 and the injected PORT variable (most common)
- Target port of the public domain does not match the port the app uses
- App overloaded and unable to answer requests
This guide also covers
- railway application failed to respond
- railway 502 bad gateway
- railway app not working
Still not working?
If Railway keeps failing, you're not alone. See every Railway problem users report or the alternatives people switch to.
Have an app idea? Our small team builds any software: web and mobile apps, games, desktop, AI tools. Price agreed together.
Talk to usOther Railway errors
- Railway: No Start Command Could Be Found
- Railway Slow Deployments and Slow App
- Railway Node.js SIGTERM Handler Not Running
- Railway ENOTFOUND redis.railway.internal
- Railway Postgres: Could Not Locate a Valid Checkpoint Record
- Railway SSL Certificate Stuck or Not Working (526, 525, Too Many Redirects)
- Railway 405 Method Not Allowed on POST Requests
- Railway Services Stopped: Trial Credits Ran Out