Sorry-I take liberty in posing a hypothetical rewrite situation
- path: /analytics/spark/master(/|$)(.*)
- path: /analytics/jupyter/lab(/|$)(.*)
- Does consul-ingress support rewrites like above?
- Does newly published api-gw supports them as well?
Have we got rich documentation with some examples?
Consul’s ingress gateway and service mesh sidecars do not currently support configuring regex rewrites in Envoy, although I think this would be a worthwhile feature to support.
In order to implement similar functionality with the string replacement functionality of the prefix rewrite feature, you would need to use the following configuration.
# This will replace '/analytics/spark/master/' in the path with '/'.
# Any values proceeding the trailing slash will remain in the path.
# For example, a request to '/analytics/spark/master/foo' will be written to '/foo'
- port: 80
- name: ingress-fanout-virtual-service
Envoy’s documentation for the
prefix_rewrite parameter explains the reason that multiple match directives are required.
I’m not sure whether Consul’s API Gateway currently supports using regular expressions to rewrite paths. In looking at the code, it appears it might support regex path matching, but not rewriting. My colleague @Jeff-Apple can confirm these details.