Virtual service not working with hostname and prefix

Hello Friends.

Wanted to define contexpath and according to path traffic will service. i wanted to define host url and prefix and according to prefix request routed to different pod.

Working script, but here i need to use IP/prefix to access, i want to access domainname/prefix

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: istio-{{ .Values.service.name.firstservice }}-vs
spec:
hosts:

  • “*”
    gateways:
  • istio-istio-gateway.default.svc.cluster.local
    http:
  • match:
    • uri:
      exact: “/security-web”
    • uri:
      prefix: “/security-web”
      route:
    • destination:
      port:
      number: {{ .Values.service.port.firstservice }}
      host: {{ .Values.service.name.firstservice }}.{{ .Release.Namespace }}.svc.cluster.local

where as when i define host detail in place of start, It is not working

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: istio-{{ .Values.service.name.firstservice }}-vs
spec:
hosts:

  • practice.exampleurl.net
    gateways:
  • istio-istio-gateway.default.svc.cluster.local
    http:
  • match:
    • uri:
      exact: “/security-web”
    • uri:
      prefix: “/security-web”
      route:
    • destination:
      port:
      number: {{ .Values.service.port.firstservice }}
      host: {{ .Values.service.name.firstservice }}.{{ .Release.Namespace }}.svc.cluster.local

Thanks
Shrwan