Configures HTTP header-based routing for Service B in AWS App Mesh, targeting requests with specific header values.

Terraform Template

resource "aws_appmesh_route" "serviceb" {
  mesh_name = "aws_appmesh_mesh.simple.id"
  name = "serviceB-route"

  spec {

    http_route {

      action {

        weighted_target {
          virtual_node = "aws_appmesh_virtual_node.serviceb.name"
          weight = 100
        }
      }

      match {
        header = "[object Object]"
        method = "POST"
        prefix = /
        scheme = "https"
      }
    }
  }
  virtual_router_name = "aws_appmesh_virtual_router.serviceb.name"
}