Skip to content

NGF does not support mixed external name and local service in the same HTTPRoute #4187

@ciarams87

Description

@ciarams87

When routing to an ExternalName service alongside internal services in the same HTTPRoute, NGF incorrectly sets the Host header to the Gateway's hostname instead of the external service's hostname, causing requests to fail. Example Configuration:

apiVersion: v1
kind: Service
metadata:
  name: httpbin
spec:
  type: ExternalName
  externalName: httpbin.org
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: mixed-route
spec:
  parentRefs:
  - name: gateway
  hostnames:
  - cafe.example.com
  rules:
  - matches:
    - path:
        type: PathPrefix
        value: /external
    backendRefs:
    - name: httpbin  # ExternalName service
      port: 443
  - matches:
    - path:
        type: PathPrefix
        value: /internal
    backendRefs:
    - name: coffee  # ClusterIP service
      port: 80

Expected Behavior: Requests to /external should have Host: httpbin.org header set when proxying to the external service.

Actual Behavior: Requests to /external have Host: cafe.example.com header set, causing the external service to reject the request (typically with 503 or host mismatch errors).

Impact:
ExternalName services cannot be used for routing to external APIs/services that require correct Host headers

No workaround available (we don't allow Host header modification via RequestHeaderModifier)

Properly set Host header based on ExternalName service hostname.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingrefinedRequirements are refined and the issue is ready to be implemented.

Type

Projects

Status

✅ Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions