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.
Prerequisites
Section titled “Prerequisites”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.
HTTPRoute basics
Section titled “HTTPRoute basics”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/v1kind: HTTPRoutemetadata: name: my-routespec: parentRefs: - name: my-gateway rules: - backendRefs: - name: my-service port: 80Both 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.
DNS Mode’s data plane is Envoy Gateway, unmodified — this project’s own controller never
touches HTTPRoute routing behavior in this mode at all, so every HTTPRoute feature Envoy
Gateway itself implements (header/method/query-param matching, weighted backends, filters, and
so on) is available exactly as Envoy Gateway implements it. Nothing from the Tunnel Mode
restrictions above applies here.
Cross-namespace attachment
Section titled “Cross-namespace attachment”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/v1kind: Gatewaymetadata: name: my-gatewayspec: gatewayClassName: my-gateway-class listeners: - name: http protocol: HTTP port: 80 allowedRoutes: namespaces: from: Allfrom 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. |
This project’s own controller never evaluates allowedRoutes.namespaces in this mode — Envoy
Gateway decides route attachment (including from: Selector) entirely on its own, the same way
it owns every other HTTPRoute/GRPCRoute routing behavior here. See the
HTTPRoute basics tab above for the same point made about routing in
general.
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.
GRPCRoute
Section titled “GRPCRoute”A GRPCRoute matches on method.service/method.method rather than HTTP paths:
apiVersion: gateway.networking.k8s.io/v1kind: GRPCRoutemetadata: name: my-grpc-routespec: parentRefs: - name: my-gateway hostnames: - "grpc.example.com" rules: - matches: - method: service: my.package.MyService method: MyMethod backendRefs: - name: my-grpc-service port: 9443Four 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.
- Exact
method.service/method.methodmatching only. No header matching, noRegularExpressionmethod matching, no rule-level orbackendRef-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.portis also required — an unset port is rejected the same way.) - The parent Gateway’s tunnel has to run the
http2edge transport. Left on the default transport,cloudflareddrops gRPC trailers. See Tunnel Tuning for how to opt a Gateway’s tunnel intohttp2— until that policy isAccepted, anyGRPCRouteon that Gateway is rejected withAccepted=False/UnsupportedFeature. - 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 Forbiddenand an HTML body before the request ever reachescloudflared— indistinguishable from a routing bug unless you know to check this first. Enable it once per zone before applying aGRPCRoutein Tunnel Mode. - The backend itself has to be a TLS-terminating origin advertising ALPN
h2, not a plain h2c gRPC server. This project’s translation layer forcesservice: https://…plusoriginRequest.http2Origin: trueonto 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 gRPCService) sits behind a tunnel that silently never completes the HTTP/2 handshake with it, even though the route itself reportsAccepted=True. Put a TLS-terminating, ALPN-h2-negotiating proxy (for example Envoy) in front of the h2c backend and pointbackendRefat that proxy instead.
apiVersion: gateway.networking.k8s.io/v1kind: GRPCRoutemetadata: name: my-grpc-routespec: parentRefs: - name: my-gateway hostnames: - "grpc.example.com" rules: - matches: - method: service: my.package.MyService method: MyMethod backendRefs: - name: my-grpc-service port: 9443Envoy Gateway handles GRPCRoute natively, the same way it handles HTTPRoute — this
project’s controller adds no code and no restriction on top. None of the tunnel-specific
requirements in the other tab apply here: there’s no http2-transport policy to attach, and
no translation layer forcing a TLS+ALPN-h2 origin onto your backend. For a DNS-only
record (dnsDefaults.proxied: false), traffic never passes through Cloudflare’s edge at all,
so there’s no zone-level gRPC flag to consider either. For a proxied record
(dnsDefaults.proxied: true), Cloudflare’s edge is in the request path the same way it is for
any proxied hostname, and gRPC traffic to a proxied hostname is subject to Cloudflare’s own
standard gRPC requirements — this project has no evidence either way for that path: the only
DNS-mode GRPCRoute testing behind this page dialed the Envoy listener directly, bypassing
Cloudflare’s edge entirely.
TLSRoute
Section titled “TLSRoute”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.
Supported, mode: Passthrough only, with two corrections to ordinary behavior:
apiVersion: gateway.networking.k8s.io/v1kind: Gatewaymetadata: name: my-passthrough-gwspec: gatewayClassName: my-dns-mode-class listeners: - name: tls-passthrough protocol: TLS port: 8443 hostname: "passthrough.example.com" tls: mode: Passthrough allowedRoutes: kinds: - kind: TLSRoute---apiVersion: gateway.networking.k8s.io/v1kind: TLSRoutemetadata: name: my-passthrough-routespec: parentRefs: - name: my-passthrough-gw sectionName: tls-passthrough hostnames: - "passthrough.example.com" rules: - backendRefs: - name: my-tls-backend port: 8443- No certificate is issued for it. TLS terminates at the backend Pod, not at Envoy or
Cloudflare, so a passthrough listener never receives a cert-manager
Certificate— issuing one would be pointless at best and a correctness bug at worst. proxied: falseis forced. An orange-clouded (proxied) record terminates TLS at Cloudflare’s edge, which is the opposite of passthrough. This controller forcesproxied: falsefor any hostname a passthrough listener claims, overriding whatever yourCloudflareGatewayConfigurationsets as a default, and reports the override through an Event. If the same hostname is ever claimed by both a passthrough and a terminate listener, passthrough wins and the record stays unproxied.
TCPRoute
Section titled “TCPRoute”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.
Not rejected — never even watched. Envoy Gateway discovers TCPRoute only through an older
Gateway API version than the CRDs this project currently pins serve for that kind, so Envoy
Gateway never registers a watch for it at all. A TCPRoute applied to a DNS Mode Gateway gets
no status whatsoever, not even a rejection, while the listener’s port still appears open to a
plain TCP connect. This is the one honest exception to this page’s closing claim below — it
isn’t this project’s own controller declining to write a status, it’s that nothing in the
request path ever looks at the object at all. It’s a version-pin limitation, not a permanent
one.
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.