-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
I would like to have a way of modifying upstream request headers including host/:authority.
I can alter headers via request_headers_to_add or lua code, but changing host/:authority is done before virtual host matching and so it changes virtual host picked, or results in 404.
I need virtual host to be picked using downstream request's host/:authority and only then alter headers sent to upstream.
Why do I need it: I would like to multiplex traffic from many services to envoy through single listener with one virtual host per service. Envoy is not aware of all domains (with possible subdomains) of these services, so I would substitute original host with known per service vhost name storing original host in some other header first. Envoy selects exact virtual hosts efficiently with a map and so I would like not to use wildcard domains, or long route chains matching custom headers.
Example of traffic:
Original request | Request from load balancer to Envoy | Request from Envoy to upstream
------------------------------------------------------------------------------------------------------
Host: a.example.com | Host: a, X-Original-Host: a.example.com | vhost a -> Host: a.example.com
Host: b.example.com | Host: b, X-Original-Host: b.example.com | vhost b -> Host: b.example.com
Host: a.c.example.com | Host: c, X-Original-Host: a.c.example.com | vhost c -> Host: a.c.example.com
Host: b.c.example.com | Host: c, X-Original-Host: b.c.example.com | vhost c -> Host: b.c.example.com
Is it possible?