proxy-wasm-go-sdk
proxy-wasm-go-sdk copied to clipboard
Question: Generic cluster for DispatchHttpCall?
I'd like to make calls using proxywasm.DispatchHttpCall(...)
to various URLs. Is it possible to have a cluster in the envoy config that will use the :authority
header and forward the request on?
I was exploring something like:
clusters:
- name: dynamic_forward_proxy_cluster
lb_policy: CLUSTER_PROVIDED
cluster_type:
name: envoy.clusters.dynamic_forward_proxy
typed_config:
"@type": type.googleapis.com/envoy.extensions.clusters.dynamic_forward_proxy.v3.ClusterConfig
dns_cache_config:
name: dynamic_forward_proxy_cache_config
dns_lookup_family: V4_ONLY
but end up getting errors like:
[debug][router] [source/common/router/router.cc:514] [Tags: "ConnectionId":"0","StreamId":"1203041025397599499"] cluster 'dynamic_forward_proxy_cluster' match for URL '/post'
[debug][upstream] [source/extensions/clusters/dynamic_forward_proxy/cluster.cc:396] host httpbin.org:80 not found
[debug][upstream] [source/common/upstream/cluster_manager_impl.cc:2010] no healthy host for HTTP connection pool
[debug][http] [source/common/http/async_client_impl.cc:106] async http request response headers (end_stream=false):
':status', '503'
'content-length', '19'
'content-type', 'text/plain'
[14954665][error][wasm] [source/extensions/common/wasm/context.cc:1193] wasm log: dispatch http call failed: error status returned by host: internal failure
[14954665][critical][wasm] [source/extensions/common/wasm/context.cc:1196] wasm log: Error dispatching payload: error status returned by host: internal failure
with headers like:
hs := [][2]string{
{"accept", "*/*"},
{":authority", "httpbin.org"},
{":method", "POST"},
{":path", "/post"},
{":scheme", "http"},
{"Content-Type", "application/json"},
}