用例:我需要在将两个标头与“AND”逻辑匹配后向服务器(集群)发送请求。
这在 Envoy 中可能吗?如果是,请帮助语法或解决方案-
我的特使配置图看起来像-
kind: ConfigMap
metadata:
name: test-envoy-conf
data:
envoy.yaml: |
static_resources:
listeners:
- address:
socket_address:
address: 0.0.0.0
port_value: 443
traffic_direction: OUTBOUND
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: AUTO
stat_prefix: ingress_http
route_config:
name: local_route
virtual_hosts:
- name: https
domains:
- "*"
routes:
- match:
prefix: "/"
headers:
- name: x-envoy-original-dst-host
string_match:
suffix: ": 10004"
- name: app
exact_match: "ms-example-server"
and_match: true
route:
cluster: destination_cluster
http_filters:
- name: envoy.filters.http.router
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
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/envoy/tls.crt"
private_key:
filename: "/etc/ssl/envoy/tls.key"
# Setup the Original Destination cluster
clusters:
- name: destination_cluster
.....
是否可以基于 AND 逻辑匹配标头并在 envoy 中发送到所需的集群?
尝试类似的东西
and_match:
rules:
- http_request_headers_match:
headers:
- name: foo
string_match:
exact: bar
- http_response_headers_match:
headers:
- name: bar
string_match:
exact: baz