Listeners, filters, and the HCM
Follow a request from the socket to the router filter.
The path of a request
Every HTTP request that hits Envoy walks the same pipeline:
Three things to internalize:
- A listener binds a port. One Envoy can have many listeners.
- The HCM is itself a network filter — it sits inside the listener's filter chain and turns raw bytes into HTTP requests.
- Inside the HCM is its own chain of HTTP filters. The last one is
always
envoy.filters.http.router— it's the filter that actually sends the request upstream.
A real, runnable hello-world
This is the canonical first Envoy config: listen on port 10000, proxy
everything to httpbin.org.
admin:
address:
socket_address: { address: 0.0.0.0, port_value: 9901 }
static_resources:
listeners:
- name: listener_0
address:
socket_address: { address: 0.0.0.0, port_value: 10000 }
filter_chains:
- filters:
- name: envoy.filters.network.http_connection_manager
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
stat_prefix: ingress_http
http_filters:
- name: envoy.filters.http.router
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
route_config:
name: local_route
virtual_hosts:
- name: local_service
domains: ["*"]
routes:
- match: { prefix: "/" }
route:
cluster: httpbin
host_rewrite_literal: httpbin.org
clusters:
- name: httpbin
type: LOGICAL_DNS
connect_timeout: 1s
load_assignment:
cluster_name: httpbin
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address: { address: httpbin.org, port_value: 80 }
Yes, it's verbose. Yes, the @type URLs feel like punishment. Both go away
once you stop reading them and start recognizing the shape of the config.
Save the config above as envoy.yaml, then:
docker run --rm -it \
-p 10000:10000 -p 9901:9901 \
-v "$PWD/envoy.yaml:/etc/envoy/envoy.yaml" \
envoyproxy/envoy:v1.31-latest
In another terminal:
curl -s localhost:10000/get | head -20
You're hitting Envoy on port 10000; Envoy is calling httpbin.org for you
and streaming the response back. Your first reverse-proxy config — done.
Now visit http://localhost:9901/clusters and find your httpbin cluster
with its single endpoint and active health. That's the same data Envoy
maintains for every cluster, no matter how complex things get later.
If you forget envoy.filters.http.router or put another HTTP
filter after it, requests will hang or return errors. The router is the
terminal filter — it's what actually dispatches to the upstream. Every
HTTP filter chain ends with it.
The mental model that pays off
Once you see the pipeline as listener → filter chain → HCM → HTTP filters → router → cluster, every Envoy feature you'll meet later just slots into one of those boxes:
- TLS termination? A
transport_socketon the filter chain. - Rate limiting / JWT auth / ext-authz? HTTP filters before router.
- Load balancing? Inside the cluster.
- Path rewrites, weighted canary? On the route.
- Health checks, circuit breakers? On the cluster too.
Same skeleton, more filling.
Try breaking it on purpose
A surprising amount of Envoy intuition comes from watching it fail clearly.
After the curl works, comment out the envoy.filters.http.router
block and restart. Send another request. Read the error. Now put it back.
You'll never forget that the router has to be there.
Where must `envoy.filters.http.router` appear in your HTTP filter chain?