2

For envoy routing, I've multiple prefix matches for routing to different clusters. For routing to same cluster, I have to repeat the match section. For e.g., this is a section of routes in enovy-config.yaml

          - match:
              prefix: "/api/v1/config/"
            route:
              cluster: cluster2
          - match:
              prefix: "/api/service/risk/"
            route:
              cluster: cluster2

I cannot match on /api as most of my services start with that and I am ending up writing multiple match/prefix for routing to same cluster. Is there a way to group the prefixes that go to same cluster without having to repeat the match section? Is this even possible?

Wander3r
  • 1,801
  • 17
  • 27

1 Answers1

3

Essentially, no. If you want to do explicit prefix matching, then you need these repeat structures for each one.

However, if you can instead do matching based off of a regex pattern, then you can use the safe_regex matching to route a bunch of paths to a given cluster. api docs here

justincely
  • 955
  • 7
  • 12
  • Yes. Found from the documentation that nesting or grouping is not possible and used the regex. But yaml looked ugly and ended up doing the multiple match prefixes. – Wander3r Sep 23 '20 at 04:09