<p>Referencing the bookinfo yaml here :
My gateway looks like :</p>
<pre><code>apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: bookinfo-gateway
spec:
  selector:
    istio: ingressgateway # use istio default controller
  servers:
  - port:
      name: https
      number: 443
      protocol: https
    tls:
      mode: PASSTHROUGH
    hosts:
    - &quot;*&quot; 
</code></pre>
<p>Configuring it to accept https from all host. However, in the VirtualService, I want to achieve a URL match based routing. This is how my current configuration for VS looks.</p>
<pre><code>apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: bookinfo
spec:
  hosts:
  - &quot;*&quot;
  gateways:
  - bookinfo-gateway
  tls:
  - match:
    - uri:
        prefix: /productpage
    - port: 443
      sniHosts:
      - &quot;*&quot;
    route:
    - destination:
        host: productpage
        port:
          number: 9080
</code></pre>
<p>On deploying it fails with the error, &quot;TLS match must have at least one SNI host&quot;. The same VS configuration works if I remove the uri match criteria.</p>
<p>Is there a way to have URI match based routing for TLS while keeping generic sniHosts (as my host is common and I need to route to a particular app based on url prefixes)?</p>

<p>In Istio, VirtualService TLS Match does not contains URI based routing (<a href="https://istio.io/latest/docs/reference/config/networking/virtual-service/#TLSMatchAttributes" rel="nofollow noreferrer">link</a>) . TLS is kind of opaque connection which can perform only host based routing (as hostname is present in the client hello tcp handshake).</p>
<p>In order to achieve path based routing, you will need to terminate the TLS as the gateway level and perform routing based on http. HTTP messages are transparent messages where L7 routing can be applied by istio or any other intermitient layer.</p>
<p>Another alternative is to use nginx or any other reverse proxy (which performs the ssl termination and route the call to appropirate service directly). In short, in order to perform L7 based routing (path based one of them), you will need to decrypt the request (TLS termination) whether it is done at istio end or application end.</p>
