Fix a 502 Bad Gateway on seenode
A 502 Bad Gateway on seenode means your app isn't listening on the port seenode routes to. Here's how to fix it.
The error
Visiting your web service’s URL returns 502 Bad Gateway.
Quick fix
A 502 almost always means nothing is listening on the port seenode routes to. seenode forwards public traffic to the port set in your service’s Port field (default 80). Make your app:
- Listen on host
0.0.0.0, not127.0.0.1orlocalhost. - Listen on the exact port in the service’s Port field.
Then redeploy.
For example, if the Port field is 80:
# Gunicorngunicorn app:app --bind 0.0.0.0:80# Uvicornuvicorn main:app --host 0.0.0.0 --port 80Why this happens
seenode’s load balancer accepts requests on 443/80 and forwards them to your container on the port you configured. If your app binds to a different port, binds only to localhost, crashed on startup, or never started, the load balancer has nothing to talk to and returns 502.
Checklist
- The port your app binds to matches the Port field exactly.
- You bind to
0.0.0.0, notlocalhost/127.0.0.1. - The service actually started: check the Logs tab (Runtime) for a “listening on…” line or a crash.
- Your start command runs a long-lived server process, not a one-off command that exits.