Istio HTTPRedirect Capture Group Support

10/17/2019

Note: I have a feeling this isn't supported in Istio, but I'm curious if any other reverse-proxy supports this feature besides NGINX?

I am trying to redirect requests from regex: /abc/(?<appname>.*)? to /cba/$appname in a VirtualService within Istio. This seems like a trivial problem granted Istio is supposed to replace NGINX Ingresses, so it seems concerning there isn't much mention of this problem in their docs.

I have found several other posts that refer to similar issues, but I want an explicit answer this is not supported.

I have the following working example that simply redirects the regex /abc/.* to the static address /cba/.

http:
- match:
  - uri:
      regex: /abc/.*?
    ignoreUriCase: true
  rewrite:
    uri: /cba/
- match: 
  - uri: 
      prefix: /
  route: 
  - destination:
      host: service_name

Adding a Capturing Group in the URI regex: /abc/(?<hello>.+)? results in the following error, despite the regex being syntactically correct.

gRPC config for type.googleapis.com/envoy.api.v2.RouteConfiguration rejected: Invalid regex '/abc/(?<hello>.+)?': One of *?+{ was not preceded by a valid regular expression.

Is there something I am missing, or any pointers towards finding a solution to this problem?

Also Note: The documentation for HTTPRewrite states the uri field must be a string, which also makes me worry this feature isn't supported.

I've tried looking through Envoy's documentation and it seems to stem from them not supporting it? Is there any way to extract fields from a regex in any reverse-proxy except NGINX?

-- Baily
ambassador
envoyproxy
istio
kubernetes
kubernetes-ingress

0 Answers