istio virtual service with multiple root paths

i have been on this implementation for a few days now and for the life of me i cannot solve the issue and i am running out of ideas and knowledge, without talking about the level of frustration.

i am using azure api management for my apis. and i have 2 operations as follow:

  1. and api that is set on this path: https://my-api.azure-api.net/ap and have 1 Operation (GET: /) in the frontend and the backend is forwarded to kubernetes internal pod on this url (my-kubernetes.example.com)
  2. and api that is set on this path: https://my-api.azure-api.net/apaks and have 1 Operation (GET: /template/{Id}/languages) in the frontend and the backend is forwarded to kubernetes internal pod on this url (my-kubernetes.example.com)

the above is the apim configuration. While in istio i have the following yaml files:

ap/aks ingress:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: apaks-ingress
spec:
  ingressClassName: istio
  rules:
    - host: my-kubernetes.example.com
      http:
        paths:
          - pathType: Prefix
            path: /
            backend:
              service:
                name: apaks
                port:
                  number: 80
  tls:
    - hosts:
        - my-kubernetes.example.com
      secretName: api-istio-cert

apaks virtual service:

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: apaks
  namespace: default
spec:
  hosts:
    - "*"
  gateways:
    - istio-system/api
  http:
    - match:
        - uri:
            prefix: /apaks
      rewrite:
        uri: /template/{Id}/languages
      route:
        - destination:
            host: apaks.default.svc.cluster.local
            port:
              number: 80
      headers:
        request:
          add:
            x-ms-client-principal-id: "2d85462-b043-5264-adac-3b1061b19eb7"


and apaks destination rule:

apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
  name: apaks-destination
  namespace: default
spec:
  host: apaks.default.svc.cluster.local
  trafficPolicy:
    tls:
      mode: ISTIO_MUTUAL

while for the second api i have a similar implamations

ap ingress:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ap-ingress
spec:
  ingressClassName: istio
  rules:
    - host: my-kubernetes.example.com
      http:
        paths:
          - pathType: Prefix
            path: /
            backend:
              service:
                name: ap
                port:
                  number: 80
  tls:
    - hosts:
        - my-kubernetes.example.com
      secretName: api-istio-cert

ap virtual service

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: ap
  namespace: default
spec:
  hosts:
    - "*"
  gateways:
    - istio-system/api
  http:
    - match:
        - uri:
            prefix: /ap
      rewrite:
        uri: /
      route:
        - destination:
            host: ap.default.svc.cluster.local
            port:
              number: 80
      headers:
        request:
          add:
            x-ms-client-principal-id: "2d85462-b043-5264-adac-3b1061b19eb7"

and ap destination rule:

apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
  name: ap-destination
  namespace: default
spec:
  host: ap.default.svc.cluster.local
  trafficPolicy:
    tls:
      mode: ISTIO_MUTUAL

both application (svc) respond on the root path /.

if i apply the apaks alone, i am able to hit on the url

https://my-api.azure-api.net/apaks/template/{Id}/languages

and get back a 200 OK, all good so far.

but if i try to apply the ap yaml, the apks stops working with a 404 and also the /ap respond with a 404.

So my frustration lead me here with the following question:

In a scenario where i have multiple services that respond only on / how can i configure istio to route the traffic correctly to the right destination?

Thank you so much for anyone who can help me out with this and lift this weight, i am totally lost and confused..did i said already frustrated?

If you need anymore details please do not hesitate to ask

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật