Traffic split via header request

In API gateway or service mesh as Istio, Gloo,... I can use virtual service to split traffic via header. How can I do it with maesh?

Hi @vuxuanlai,

Thanks for your interest in Maesh :smiley:

As Maesh is compliant with SMI you can use a TrafficSplit with an HTTPRouteGroup which defines an header matching rule.

This feature is not available in v1.3.0 but it will be available in the upcoming version.

Hi @kevinpollet,
Thanks for your reply.
I want to split traffic as following:

  1. When I call to service point with header "stage: canary", maesh will route traffic to service v2
    ex: curl service.namespace.maesh -H "stage: canary" ---> service v2
  2. When I call to service endpoint with path "/api", maesh will route traffic to service v1
    ex: curl service.ns.maesh/api ---> service v1.

How can I do it?

Thanks.

Hi again,

I haven't tested the following configuration but maybe you can try something like this (pseudo config):

TrafficSplit:
  service: base
  rules: HTTPRouteGroup(header: stage=canary)
  backends: 
    service-v2: weight=100

TrafficSplit:
  service: base
  rules: HTTPRouteGroup(path: /api)
  backends:
    service-v1: weight=100

Hope this helps.