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

Is it possible to make HTTPS calls using DipatchHttpCall #416

Closed
harsha-konda opened this issue Dec 20, 2023 · 1 comment
Closed

Is it possible to make HTTPS calls using DipatchHttpCall #416

harsha-konda opened this issue Dec 20, 2023 · 1 comment

Comments

@harsha-konda
Copy link

harsha-konda commented Dec 20, 2023

Describe the bug / error

Is HTTPS protocol supported by DispatchHttpCall? I looked around in the docs and there was nothing to indicated explicitly that https is supported.
here's my code to make a https call

proxywasm.DispatchHttpCall(
		"outbound|443||echoservice.com",
	{{":authority" ,"echoservice.com" }, {":scheme","https"}, {":method","GET"}},
		nil, nil, 5000,
		ctx.dispatchCallback,
	)

I got the following error

<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>
</body>
</html>

What is your Envoy/Istio version?

1.2.0

What is the SDK version?

What is your TinyGo version?

0.30.0

URL or snippet of your code including Envoy configuration

Additional context (Optional)

@harsha-konda
Copy link
Author

harsha-konda commented Dec 20, 2023

Since I haven't gotten an answer here's a workaround that i found

In the described setup, requests originating from WebAssembly (Wasm) are initially sent as HTTP, similar to previous configurations. However, before these requests reach the internet, they are converted into HTTPS. This transformation is accomplished using Envoy's Cluster Socket Transport feature.

This can be achieved in Istio by using a destination rule along with a service entry for the https endpoint

apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
  name:api
  namespace: apispec:
  hosts:
  - api.com
  exportTo:
  - api
  ports:
  - number: 443
    name: https-port
    protocol: HTTPS
  location: MESH_EXTERNAL
  resolution: DNS
---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
  name: api-destination-rule
  namespace: apispec:
  host: api.com
  trafficPolicy:
    tls:
      mode: SIMPLE

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

No branches or pull requests

2 participants