ahmad55666
FREEOP
a month ago
Need help with Railway + FastAPI
My app works fine on localhost — all routes like /webhook work.
But on Railway, only /health works — everything else shows 404 Not Found.
No errors in logs, app starts fine.
I’m using uvicorn app:app.
Maybe the railway.toml or start command is wrong?
Example:
uvicorn main:app --host 0.0.0.0 --port $PORT
Any idea why only /health works?
( I am on free plan )
3 Replies
first, make sure your start command/toml matches the cmd and stuff
railway sometimes sets a root path if your app is behind a proxy path so try explicitly settings root_path='' to make sure it doest expect a sub path
app = FastAPI(root_path=os.getenv("railway url", ""))
if you can show more stuff then please cuz kinda hard to diagnose