Start with the failing request
A 502 or 504 response may be caused by a reverse proxy, DNS resolution, the upstream application, container networking, timeouts, or resource saturation. Restarting services without evidence can hide the original cause.
Investigation workflow
- Confirm the affected hostname, path, timestamp and blast radius.
- Inspect proxy configuration and error logs.
- Check whether the upstream process is listening and responding from the correct network.
- Read application logs and runtime status for restarts, CPU or memory pressure.
- Compare observations with a testable hypothesis before making changes.
- Verify the actual user request after recovery, not just the process state.
Read-only examples
# Nginx configuration, when running in a container
docker exec nginx-proxy nginx -t
# Runtime status
docker ps --all
podman ps --all
# Inspect recent application logs
docker logs --tail 100 app
# Kubernetes workload state
kubectl get pods -A -o wide
kubectl get events -A --sort-by=.lastTimestamp
In production, inspect the environment and command context before running any changes. A reliable troubleshooting process leaves a record of evidence and post-change checks.