proxy-wasm-go-sdk
proxy-wasm-go-sdk copied to clipboard
How to call a https request by use DispatchHttpCall ?
How to call a https request by use DispatchHttpCall
This is my code:
cluster := "outbound|443||httpbin.org"
headers := [][2]string{
{":scheme", "https"},
{":method", "GET"},
{":path", "/get"},
{":authority", "httpbin.org"},
{"accept", "*/*"},
}
data, err := proxywasm.DispatchHttpCall(
cluster,
headers,
nil,
nil,
1000,
func(numHeaders, bodySize, numTrailers int) {
resp, _ := proxywasm.GetHttpCallResponseBody(0, 10000)
r := string(resp)
proxywasm.LogCriticalf("response: %v", r)
proxywasm.ResumeHttpRequest()
})
ServiceEntry.yaml
apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
name: external-svc-httpbin
spec:
hosts:
- httpbin.org
location: MESH_EXTERNAL
ports:
- number: 443
name: https
protocol: TLS
resolution: DNS
Response:
response: <html>
<head><title>400 The plain HTTP request was sent to HTTPS port</title></head>
<body>
<center><h1>400 Bad Request</h1></center>
<center>The plain HTTP request was sent to HTTPS port</center>
<hr><center>ALB</center>
</body>
</html>
my question is how to call a HTTPS request
I've encountered the same issue. @mathetake - do you know if it's even possible?
Hi @mathetake could you please let me know if its possible?
https://github.com/tetratelabs/proxy-wasm-go-sdk/pull/451