Skip to content

Pass SNI to origin + Istio ingress gateway #541

Description

@BojanZelic

I'm trying to configure the cloudflared tunnel to work with Istio. Istio Ingress Gateway uses SNI to match the request on where it routes traffic to. I can't seem to figure out a way that I could pass SNI information from cloudflared tunnel -> the origin automatically.

I can see that Host headers come through without issue. Is there a way to automatically get the SNI information from the original user request and pass it through?

I can manually hardcode it for every entry as a workaround for now.

What I'm trying to achieve:

credentials-file: "/var/run/cloudflared/<id>.json"
ingress:
- hostname: "*.mydomain.io"
  service: https://istio-ingressgateway.istio-system.svc.cluster.local
- service: http_status:404
tunnel: <id>

But this doesn't work and it's essentially the equivalent of this:

curl -v -HHost:host1.mydomain.io https://istio-ingressgateway.istio-system.svc.cluster.local

My current workaround:

credentials-file: "/var/run/cloudflared/<id>.json"
ingress:
- hostname: "host1.mydomain.io"
  originRequest:
    originServerName: host1.mydomain.io
  service: https://istio-ingressgateway.istio-system.svc.cluster.local
- hostname: "host2.mydomain.io"
  originRequest:
    originServerName: host2.mydomain.io
  service: https://istio-ingressgateway.istio-system.svc.cluster.local
- service: http_status:404
tunnel: <id>

Now this works and is the equivalent of:

 ISTIO_IP=$(dig +short istio-ingressgateway.istio-system.svc.cluster.local)
 curl -v -HHost:host1.mydomain.io--resolve "host1.mydomain.io:443:$ISTIO_IP" https://host1.mydomain.io -k

But I have to manually set every entry. Is there way to configure the cloudflared to pass SNI to the backend?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions