Skip to content

Routing

This page covers what each Route kind does once it’s attached to one of your Gateways: which match fields actually work, where Tunnel Mode and DNS Mode diverge, and what happens when you reach for something neither one implements.

A Gateway already running in either mode — see Quickstart — Tunnel Mode or Quickstart — DNS Mode if you don’t have one yet. The examples below assume a Gateway named my-gateway in the default namespace.

An HTTPRoute attaches to a Gateway through spec.parentRefs and sends matching requests to one or more backends through spec.rules:

apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: my-route
spec:
parentRefs:
- name: my-gateway
rules:
- backendRefs:
- name: my-service
port: 80

Both modes accept this shape. Beyond it, their real data planes diverge sharply:

cloudflared’s remotely managed ingress configuration is a single, ordered list of hostname + path + service rules — hostname and path (Exact/PathPrefix) matching, one backend per rule, and nothing else. Method matching, header matching, query-parameter matching, weighted multi-backend splits, redirects, rewrites, header modification, and request mirroring all have no equivalent on that data plane and are rejected outright rather than silently ignored — see the Not supported section of the feature reference for the full list and why each one is rejected.

A single Gateway can front HTTPRoutes and GRPCRoutes living in a different namespace than the Gateway itself, controlled per-listener by allowedRoutes.namespaces.from:

apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: my-gateway
spec:
gatewayClassName: my-gateway-class
listeners:
- name: http
protocol: HTTP
port: 80
allowedRoutes:
namespaces:
from: All
from value Support
Same (the default when unset) Supported — only routes in the Gateway’s own namespace attach.
All Supported — a route from any namespace attaches, subject to the same hostname/kind matching every other route goes through.
Selector Not supported. A route that would only attach via a namespace selector is rejected outright (the route fails to attach) rather than silently matched or mismatched.

No ReferenceGrant is needed for this specific relationship (a Gateway accepting a route from another namespace) — that object gates a route’s own backendRef into a different namespace than the route itself, which is a separate check. A route whose backend Service lives in its own namespace never needs one, regardless of which namespace the Gateway it attaches to lives in.

A GRPCRoute matches on method.service/method.method rather than HTTP paths:

apiVersion: gateway.networking.k8s.io/v1
kind: GRPCRoute
metadata:
name: my-grpc-route
spec:
parentRefs:
- name: my-gateway
hostnames:
- "grpc.example.com"
rules:
- matches:
- method:
service: my.package.MyService
method: MyMethod
backendRefs:
- name: my-grpc-service
port: 9443

Four things have to be true before this routes any traffic. Two are enforced explicitly: an unsupported match/filter shape or a missing backendRef.port (1) and a tunnel still on the default edge transport (2) are both rejected on the GRPCRoute object itself, visibly, the moment it’s applied. The other two fail silently at the traffic layer even though the GRPCRoute object is accepted: the zone’s gRPC flag (3) and the backend’s TLS/ALPN requirement (4) are both outside what this controller can check or enforce from inside the cluster.

  1. Exact method.service/method.method matching only. No header matching, no RegularExpression method matching, no rule-level or backendRef-level filters, and a rule can’t omit both fields — a hostname-wide gRPC rule would have no way to tell gRPC traffic apart from ordinary HTTP on the same hostname. Each of these is rejected the same structural way the HTTPRoute tab above rejects its own unsupported fields. (backendRef.port is also required — an unset port is rejected the same way.)
  2. The parent Gateway’s tunnel has to run the http2 edge transport. Left on the default transport, cloudflared drops gRPC trailers. See Tunnel Tuning for how to opt a Gateway’s tunnel into http2 — until that policy is Accepted, any GRPCRoute on that Gateway is rejected with Accepted=False/UnsupportedFeature.
  3. The zone’s gRPC network setting has to be enabled at Cloudflare. This is a zone-level feature flag (the dashboard’s Network → gRPC toggle) that this controller doesn’t check and cannot enable for you. With it off, Cloudflare’s edge answers gRPC requests to your tunnel hostname with a 403 Forbidden and an HTML body before the request ever reaches cloudflared — indistinguishable from a routing bug unless you know to check this first. Enable it once per zone before applying a GRPCRoute in Tunnel Mode.
  4. The backend itself has to be a TLS-terminating origin advertising ALPN h2, not a plain h2c gRPC server. This project’s translation layer forces service: https://… plus originRequest.http2Origin: true onto every gRPC-derived ingress rule — cloudflared’s HTTP/2-over-TLS negotiation has no cleartext-HTTP/2 code path, so a plain h2c backend (the ordinary in-cluster shape for a gRPC Service) sits behind a tunnel that silently never completes the HTTP/2 handshake with it, even though the route itself reports Accepted=True. Put a TLS-terminating, ALPN-h2-negotiating proxy (for example Envoy) in front of the h2c backend and point backendRef at that proxy instead.

Not supported. cloudflared’s tunnel ingress has no anonymous-public TLS-passthrough equivalent — it terminates TLS at the HTTP layer rather than SNI-routing an opaque stream to a backend. A TLSRoute parented by a Tunnel Mode Gateway is rejected outright with Accepted=False/UnsupportedFeature.

Not supported in either mode, for two unrelated reasons:

Rejected outright with Accepted=False/UnsupportedFeature — cloudflared’s tunnel ingress has no anonymous-public TCP equivalent at all; the closest thing it has requires every client to run a Cloudflare-specific access tool rather than connecting as an ordinary TCP client.

Explicitly rejected, never silently dropped

Section titled “Explicitly rejected, never silently dropped”

Every rejection on this page — every HTTPRoute/GRPCRoute match dimension and filter Tunnel Mode can’t express, every TLSRoute or TCPRoute attempted on a Tunnel Mode Gateway — surfaces as an explicit, visible condition (Accepted=False with a Reason) on the route object itself, the moment it’s applied. None of them is silently accepted and then quietly dropped on the floor. This commitment is specifically about route-level acceptance/rejection: whether the object itself gets a visible verdict. DNS Mode’s TCPRoute gap, above, is the one case on this page where that commitment doesn’t hold — not because this project’s own code silently drops it, but because nothing in the request path watches the object at all on the currently pinned versions. The GRPCRoute section above’s zone-flag and backend-TLS prerequisites (items 3/4) are a separate category, not a second exception to this commitment: the GRPCRoute object itself is still correctly Accepted, and what can fail is traffic at Cloudflare’s edge or the backend — outside anything a Kubernetes condition can observe, and documented as such rather than silently unmentioned. Everything else you’ve read above either works as documented or tells you so explicitly.

Access covers protecting any of these routes with an interactive login or a service-token gate.