Virtual Service with a dynamic host using regex capture

Hi people! Is there a way to have something like this with Istio Virtual Services and/or Envoy filter (without executing the request myself )?

- match:
    - uri:
        regex: /api/(v\d+)/foo                   
  route:
  - destination:
      host: "super-api-$1-home.com"

Thanks!

I dont think you can.

From the docs

Destination indicates the network addressable service to which the request/connection will be sent after processing a routing rule. The destination.host should unambiguously refer to a service in the service registry. Istio’s service registry is composed of all the services found in the platform’s service registry

So for each host you should have a service. It does not seems plausible to allow such a configuration, as for each different uri you would need a different service.

1 Like