0

I am trying to write an Istio virtual service that routes the Jupyter notebook pods to a certain prefix.

Inside my virtual service I have:

spec:
  gateways:
  - istio-1/ingress-gateway-1
  hosts:
  - my.domain.com
  http:
  - match:
    - uri:
        prefix: /my-custom-prefix/
    rewrite:
      uri: /
    route:
    - destination:
        host: my-jupyter-notbook-service
        port:
          number: 8888

When I go to my.domain.com/my-custom-prefix/lab - I can see that the page returns a status 200.

However, the page does not complete loading, as the static file are rewritten to /. So inside the network tab I can see that static files at my.domain.com/static/lab/... throw a 404 error. However, if I manually go my.domain.com/my-custom-prefix/static/lab/... I can see that the file is loaded successfully.

If I remove the rewrite policy then the react files fail to load and other static file are not loaded - how can I resolve this issue?

ashes999
  • 1,234
  • 1
  • 12
  • 36

2 Answers2

0

I want to help you to resolve the issue you are facing.

spec:
  gateways:
  - istio-1/ingress-gateway-1
  hosts:
  - my.domain.com
  http:
  - match:
    - uri:
        prefix: "/my-custom-prefix/"
    rewrite:
      uri: "/"
    route:
    - destination:
        host: my-jupyter-notbook-service
        port:
          number: 8888

As per from the reference Istio:Virtual Service there were missing the quotation marks.

Let me know if this resolve your issue.

Alejandro F.
  • 410
  • 3
  • 10
0

seems your static file point to /static/lab/... instead of /my-custom-prefix/static/lab/... in the web page.

if you are using create-react-app

you could set PUBLIC_URL when building the react app

docker build --build-arg PUBLIC_URL=/my-custom-prefix -t ...

in the docker file to build the react image

...
WORKDIR /app
ENV NODE_ENV=production
ARG PUBLIC_URL
ENV PUBLIC_URL=${PUBLIC_URL}
COPY ["package.json", "package-lock.json", "./"]
RUN npm install --production
...

then the static file link in the react web page should start with /my-custom-prefix/static/...

hope this resolve your issue.

Alan
  • 61
  • 1
  • 4