An HTTPRoute declares HTTP routing rules that attach to a Gateway listener and send matching requests to backend Services. The Gateway controller reports whether it accepted the route. Acceptance is a control-plane status, not a successful client transaction: DNS, TLS, backend endpoints, policy, and application behavior still determine whether the request works.
Gateway API routing: accepted route versus working request
Operational decision
A claims portal serves its case API under a path prefix. Give the HTTPRoute an explicit hostname and parent Gateway, then inspect its status conditions after applying. Verify that the named Gateway allows the route's namespace and that the backend Service has ready endpoints. The example assumes an existing public Gateway in the same namespace and a Service called claims-api on port 8080. It routes only the /cases prefix; another route must handle unrelated paths. Test the exact hostname over TLS from outside the cluster, including a missing case, a slow request, and a request during rollout. If a route is accepted but the backend is missing, inspect ReferenceResolved and backend health rather than changing DNS at random. Keep authentication and authorization in the correct edge or application layer; a route match is not an access decision.
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata: {name: claims-cases, namespace: claims}
spec:
parentRefs:
- name: claims-public
hostnames: [claims.internal.example]
rules:
- matches:
- path: {type: PathPrefix, value: /cases}
backendRefs:
- {name: claims-api, port: 8080}Cost and verification
A Gateway controller and its data plane consume capacity even when the application is idle. Path rules can overlap, so review route conflicts and host ownership before adding another team to a shared Gateway. The hostname is illustrative. Status conditions may lag reconciliation; collect both controller status and an external request result. A Service port mismatch can produce a bad backend while the route object itself parses correctly.
Common Mistakes
- Do not equate Accepted with a healthy client response.
- Do not assume a route may attach across namespaces without permission.
- Do not use path routing as a substitute for authorization.
