Hi All,
I need some helps with ServiceDefaults Envoy Extensions.
My environment:
Consul mesh version 1.16 with API Gateway
Services will route to API Gateway (path based routing)
Two services deployed and part of the mesh:
Service A
Service B (with v1 and v2)
HttpRoute Setup correctly for Service B and confirmed it was attached correctly to the API Gateway.
Wanted:
From service A , make a call out to service B (my-api-gateway.consul.svc.cluster.local/api/serviceB). By default, it will call service B V1.
Added envoy_on_request(request_handle) function to add header (version: 2) for OUTBOUND to ServiceDefaults of the Service A but the call out to service B
always hit service B V1.
Here’s the sample of ServiceDefaults envoy extensions:
- name: “builtin/lua”
required: true
arguments:
proxyType: “connect-proxy”
listener: “outbound”
script: |-
function envoy_on_request(request_handle)
request_handle:headers():add(“version”, “2”)
end
Could someone please let me know if I missed anything? Note that I can call service B V2 manually via curl -H “version: 2”
Thanks!