Skip to content

Instantly share code, notes, and snippets.

@qudongfang
Created August 17, 2022 15:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save qudongfang/75cf0230c0b2291006f72cd23d45f297 to your computer and use it in GitHub Desktop.
Save qudongfang/75cf0230c0b2291006f72cd23d45f297 to your computer and use it in GitHub Desktop.
add headers via EnvoyFilter to all hosts and routes
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: add-x-cluster-client-ip-header
namespace: istio-system
spec:
configPatches:
- applyTo: ROUTE_CONFIGURATION
match:
context: SIDECAR_INBOUND
patch:
operation: MERGE
value:
request_headers_to_add:
- header:
key: 'x-cluster-client-ip'
value: '%DOWNSTREAM_REMOTE_ADDRESS_WITHOUT_PORT%'
append: false
# the following is used to debug
response_headers_to_add:
- header:
key: 'x-cluster-client-ip'
value: '%DOWNSTREAM_REMOTE_ADDRESS_WITHOUT_PORT%'
append: false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment