Virtual service rewrite and problem with page not found

Hi all,
Summary: when a resource/page is not found on a microservice, the browser/client redirects to URL that confuses end user.

I am using virtual service rewrite to send request with ‘/email/’ to a specific microservice.
This microservice doesn’t know about the ‘/email/’.
So instead of going to
http://www.fake.edu/swagger/’, user can go to
'http://www.fake.edu/email/swagger/".

Problem is when I go to
http://www.fake.edu/email/swagger’, note the missing / at the end.
browser will redirect to
http://www.fake.edu/swagger’.
I believe this is because the microservice cannot find the resource and since it doesn’t know about the ‘/email/’ part, the microservice sends back response that leads to this confusion.

Any advise welcomed, thanks.

here is the yaml I use for virtual service
kind: VirtualService
metadata:
name: emailservice
spec:
hosts:

  • “*”
    gateways:
  • fourfourthreeservicegateway
    http:
  • match:
    • uri:
      prefix: /email/
      rewrite:
      uri: /
      route:
    • destination:
      host: emailservice.msdemo.svc.cluster.local
      port:
      number: 9513