Hello people I have an architecture where I want to route my requests from Envoy Proxy to nginx proxy. as we know that Nginx works on HOST header matching to route its request. I'm having trouble setting the host header while forwarding the request from Envoy to Nginx. I have the following config
LDS.config
resources:
- "@type": type.googleapis.com/envoy.config.listener.v3.Listener
name: listener_0
address:
socket_address:
address: 0.0.0.0
port_value: 8443
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
codec_type: HTTP1
stat_prefix: ingress_http
http_filters:
- name: envoy.router
route_config:
name: local_route
virtual_hosts:
- name: app
domains:
- "some.domain.com"
routes:
- match:
prefix: "/"
route:
cluster: test-cluster
host_rewrite_literal: "mydns.com"
transport_socket:
name: envoy.transport_sockets.tls
typed_config:
"@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.DownstreamTlsContext
common_tls_context:
tls_certificates:
certificate_chain: { filename: "/etc/ssl/merged_certificate.crt" }
private_key: { filename: "/etc/ssl/key.key" }
CDS.config
resources:
- "@type": type.googleapis.com/envoy.config.cluster.v3.Cluster
name: test-cluster
connect_timeout: 30s
type: static
load_assignment:
cluster_name: test-cluster
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: my_private_ip_address
port_value: 443
I have tried the auto_host_rewrite but found that it does not works with static cluster type. but it does not updates with host_literal too.
it turns out that the config is working exactly as expected. I was looking at wrong header to verify it in the NGINX access logs. lesson learned.