22 days ago
I am getting 502 error for my gateway running on nginx.All containers are up and working fine
2 Replies
22 days ago
502 from nginx usually means it can’t reach the gateway even though containers are running.
Check:
nginx isn’t proxying to localhost (use service/container name instead)
gateway listens on 0.0.0.0, not 127.0.0.1
correct port is used (Railway often requires $PORT)
nginx error logs → they usually show the exact issue (refused/timeout/etc)
websocket apps need upgrade headers enabled
http vs https mismatch between nginx and upstream
Containers being “up” doesn’t always mean the service is reachable 
22 days ago
Un error 502 en Nginx significa que el gateway no puede conectarse al upstream. Aunque los contenedores estén activos, normalmente el problema es que Nginx está apuntando a localhost en lugar del nombre del servicio Docker, el backend no está escuchando en 0.0.0.0, o el puerto configurado en proxy_pass no coincide con el puerto real del servicio. Verifica el nombre del servicio en docker-compose, el puerto correcto y que el backend escuche en 0.0.0.0.