Fixing Common Errors
When deploying to Railway, you may encounter some errors that prevent your application from working. These are descriptions and solutions to errors that users commonly encounter.
After deploying your application, you encounter this screen when accessing your application's domain:
This error occurs when Railway is unable to connect to your application, making your request fail with status code 503 (Bad Gateway).
Railway needs to know how to communicate with your application. When you
deploy and expose a web application on Railway, we expect your web server
to be available at host
0.0.0.0 and a port that we provide in the form
PORT variable. The
PORT variable is automatically injected by
Railway into your application's environment.
Thus, your web server must listen on host
0.0.0.0 and the port that
Railway provides in the
PORT environment variable.
To fix this, start your application's server using:
- Host =
- Port = Value of the
PORTenvironment variable provided by Railway.
Below are some solution examples for common languages and frameworks.
Node / Express
Node / Nest
Node / Next
Next needs an additional flag to listen on
Python / Gunicorn
gunicorn listens on
0.0.0.0 and the
PORT environment variable by default:
There is no additional configuration necessary.
Python / Uvicorn
uvicorn needs additional configuration flags to listen on
This example is for
net/http in the Go standard library, but you can also apply this to other frameworks:
Edit this file on GitHub