'Application Failed to Respond' on Railway? Listen on 0.0.0.0 and PORT

Ship ItChecked against the official source

The short answer

Railway shows Application Failed to Respond (a 502 Bad Gateway) when its Edge Proxy cannot communicate with your app. Railway's docs say the most common reason is that "your application is not listening on the correct host or port". Your server should listen on host 0.0.0.0 and on the port in the PORT environment variable, which Railway sets automatically. Listening only on localhost works on your laptop, but not once the app is published.

What to do

  1. Change your server's start line so it listens on host 0.0.0.0 and on the PORT environment variable.
  2. If your public domain uses a target port, make it match the port your app listens on.
  3. Redeploy and open your public address again.
  4. Ask your AI tool: "My app deploys but the host says it can't reach it. Make the server listen on 0.0.0.0 and on the PORT environment variable, and show me which line you changed."

Good to know

  • It's not just Railway: Render, Fly.io and Replit have the same rule for published apps.
  • This applies to apps that run their own server (like Express, FastAPI or next start), not static sites.
  • Host and port are the most common cause, not the only one. Railway's page lists other causes too.

Source

Checked on 10 Oct 2026. Prices, limits and settings change, so check the source before you rely on them.