Kong Gateway – upsttream status 502

Common Causes of 502 Upstream Error in Kong

CategoryPossible CauseHow to Diagnose
Upstream UnreachableThe host or port in the Service is wrong or unreachableTry curl from Kong node to upstream: curl http://<host>:<port>
TimeoutsUpstream is too slow or hangsCheck Kong logs for timeout messages. Increase read_timeout, connect_timeout
DNS FailureHostname in Service cannot be resolvedCheck Kong container DNS, or use IP to test
TCP RefusedNothing is listening at upstream IP:portUse telnet <host> <port> or nc to check if port is open
SSL Error (for HTTPS upstream)Invalid certificate or mismatchUse curl -v https://host and check Kong’s trusted_certificate setting
Strip Path issuesStripping path incorrectly, leading to 404 upstreamTry setting "strip_path=false" or verify upstream path expectations
Service MisconfigWrong protocol, missing path, or upstream misbehavingDouble check service definition in Admin API or Kong Manager

Leave a comment