How to reverse proxy services using pathnames without changing the service code

Ok looks like I’ve figured out how to do this using some info in this older post. Looks like you need two match rules one for the root route / and one for all the rest of the routes /*. So this seems to have fixed it…

http:
  - match:
    - uri:
        prefix: "/graphql/"
    rewrite:
      uri: /
    route:
      - destination:
          host: my-service
          port:
            number: 80
          subset: v1
  - match:
    - uri:
        prefix: "/graphql"
    rewrite:
      uri: /
    route:
      - destination:
          host: my-service
          port:
            number: 80
          subset: v1

Note you do have to edit the code internal to the app if you’re referencing relative urls. e.g. res.redirect("/404"); needs to change to redirect("/graphql/404");