Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to call a https request by use DispatchHttpCall ? #346

Open
klausxie opened this issue Nov 23, 2022 · 2 comments
Open

How to call a https request by use DispatchHttpCall ? #346

klausxie opened this issue Nov 23, 2022 · 2 comments
Labels
question Further information is requested

Comments

@klausxie
Copy link

klausxie commented Nov 23, 2022

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

@mathetake mathetake added the question Further information is requested label Feb 27, 2023
@the-redshift
Copy link

I've encountered the same issue. @mathetake - do you know if it's even possible?

@harsha-konda
Copy link

Hi @mathetake
could you please let me know if its possible?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants