Kong – error 500

The “upstream status 500” in Kong Gateway means that Kong successfully forwarded the client request to the upstream service (your backend/API), but the upstream service itself responded with a 500 Internal Server Error.

🔍 What this typically indicates:

  • The issue is with the upstream service, not Kong.
  • Kong acted as a proxy and did its job correctly; the 500 came from your backend application.

🔁 Common causes on the upstream (backend) side:

  1. Unhandled exceptions (e.g., null pointer, syntax errors).
  2. Backend server crashed or restarted.
  3. Database connection failures.
  4. Application logic bug.
  5. Timeouts or memory issues in the backend.

🧪 How to troubleshoot:

  1. Check upstream (backend) logs at the time of the 500.
  2. Use curl directly on the backend API to verify behavior: curl -i http://<upstream_host>:<port>/<path>
  3. Enable debug logging in Kong if you want to trace the request: kong reload exit --conf kong.conf --vv
  4. Look in Kong logs:
    • /usr/local/kong/logs/error.log
    • See if Kong shows errors related to the upstream or if it just reports the 500.

🧩 Helpful Kong log fields:

If using Splunk or another log aggregator:

  • status: final status returned to client
  • upstream_status: status from upstream (i.e. 500)
  • upstream_uri: target path Kong used to reach the service
  • latencies.proxy, latencies.kong, latencies.request: for performance analysis

Let me know if you’d like a diagram of the request flow or want help decoding a specific log line.

Leave a comment