<p>I want to config the route strategy for <code>*-pim.webapi.com</code> and <code>pim.webapi.com</code>. When apply the yaml to k8s, it says the two hosts are duplicated. But I don't think they are duplicated because <code>*-pim.webapi.com</code> can not match <code>pim.webapi.com</code>. Is this a bug of istio or my mistake?</p>

<p>The VirtualService yaml is:</p>

<pre><code>apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: public-ingress
  namespace: netops
spec:
  hosts:
  - "*-pim.webapi.com" 
  - "pim.webapi.com" 
  gateways:
  - public-ingress
  http:
  - route:
    - destination:
        host: pim.default.svc.cluster.local
</code></pre>

<p>The error message is</p>

<pre><code>admission webhook "pilot.validation.istio.io" denied the request: configuration is invalid: duplicate hosts in virtual service: *-pim.webapi.com &amp; pim.webapi.com
</code></pre>

<p>The source code for this error message is here <a href="https://github.com/istio/istio/blob/master/pilot/pkg/model/validation.go#L1602" rel="nofollow noreferrer">https://github.com/istio/istio/blob/master/pilot/pkg/model/validation.go#L1602</a>. But there is no help to understand and solve my problem.</p>

Jeffrey
<p>This looks like a bug in Istio. The code you referenced calls <a href="https://github.com/istio/istio/blob/9b27fa46b934a335c58b3ca7a944af35e8dd5133/pilot/pkg/model/service.go#L540" rel="nofollow noreferrer">this function</a> to decide if the hosts match, and it's clearly doing the wrong thing in your case.</p>

<p>I would try using one host <code>*pim.webapi.com</code>, and see if that works. I'm not sure it will because I thought that wildcards could only be used for the full value of the left most component of a domain name, i.e., <code>*.webapi.com</code>, but not <code>*pim.webapi.com</code>.</p>
