Skip to content

Unexpected 500 direct_response when Service has zero Endpoints (should it be 503?) #8288

@yuntanghsu

Description

@yuntanghsu

Description:

What issue is being seen? Describe what should be happening instead of
the bug, for example: The expected value isn't returned, etc.

When the only Pod behind a Service goes down and the Service ends up with zero Endpoints, Envoy Gateway returns:

500 Internal Server Error
response_code_details: "direct_response"
upstream_cluster: null

I expected Envoy Gateway to return 503 Service Unavailable (no healthy upstream)

I would like to confirm whether returning 500 direct_response in this scenario is the intended behavior.

Repro steps:

Include sample requests, environment, etc. All data and inputs
required to reproduce the bug.

  1. Deploy a Service with a single Pod.
  2. Create an HTTPRoute pointing to that Service.
    The route is valid (Accepted=True, ResolvedRefs=True).
  3. Send a request → routing works normally.
  4. Delete or crash the only Pod.
  5. Service now has 0 Endpoints.
  6. Send the same request again.
  7. Envoy Gateway returns 500 direct_response, and Envoy does not attempt any upstream connection (upstream_cluster=null).

Note: If there are privacy concerns, sanitize the data prior to
sharing.

Environment:

Include the environment like gateway version, envoy version and so on.

envoyproxy-gateway:v1.5.0
envoy:v1.34.1

Logs:

Include the access logs and the Envoy logs.

Envoy access log
{
":authority":"aaa",
"method":"POST",
"protocol":"HTTP/2",
"response_code":500,
"response_code_details":"direct_response",
"upstream_cluster":null,
"upstream_host":null,
"x-envoy-origin-path":"ddd"
}

HttpRoute status:
status:
parents:

  • conditions:
    • type: Accepted
      status: "True"
      reason: Accepted
    • type: ResolvedRefs
      status: "True"
      reason: ResolvedRefs

Is this behavior expected?
Should Envoy Gateway return 503 instead of generating a 500 direct_response when a backend Service has zero Endpoints?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions