How to handle http 302 in VirtualService

I’m testing a VirtualService that encounters an HTTP 302 code. When this occurs the request ends with a HTTP 404 code. For purposes of testing, I’m using the set up from demo set up for the ingress and egress gateways.

istioctl install --set profile=demo

This is my VirtualService Definition

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: code-server-vs
namespace: code-server
spec:
gateways:
- code-server-gateway
hosts:
- ‘*’
http:

  • name: code-server-http
    match:
    • uri:
      exact: /code-server
      rewrite:
      uri: /
      route:
    • destination:
      host: code-server-service
      port:
      number: 80
      timeout: 300s

When it invoke the REST API http://<hostname>/code-server the logs from ingress gateway shows this

[2020-10-12T00:34:43.371Z] “GET /code-server HTTP/1.1” 302 - “-” “-” 0 0 12 11 “192.168.65.3” “curl/7.61.1” “71e82811-9b80-9c25-b9d5-8e9447e43fb5” “kubernetes.docker.internal” “10.1.0.21:8080” outbound|80||code-server-service.code-server.svc.cluster.local 10.1.0.14:35864 10.1.0.14:8080 192.168.65.3:36794 - code-server-http

[2020-10-12T00:34:43.395Z] “GET /login?to=%2F HTTP/1.1” 404 NR “-” “-” 0 0 0 - “192.168.65.3” “curl/7.61.1” “4257667b-b433-9b3d-8bbe-34e993b31dc4” “kubernetes.docker.internal” “-” - - 10.1.0.14:8080 192.168.65.3:36794 - -

Any guidance will be appreciated.

it looks like you are missing a match for the path /login