Skip to content

Handling two clusters with same path in YARP - how to route API requests correctly? #2610

Discussion options

You must be logged in to vote

I'm not sure I completely understand your setup, but if you want to route requests differently depending on their host header, you can specify the Hosts just as you're already doing with Path and Methods, e.g.

"req1_route1": {
  "ClusterId": "clusterId1",
  "Match": {
    "Path": "/path1/{**remainder}",
    "Methods": [ "GET", "POST" ],
+   "Hosts": [ "www.foo" ]
  }
},
"req2_route1": {
  "ClusterId": "clusterId2",
  "Match": {
    "Path": "/path1/{**remainder}",
    "Methods": [ "GET", "POST" ],
+   "Hosts": [ "www.bar" ]
  }
},

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@maneshachanassery
Comment options

@Tratcher
Comment options

@maneshachanassery
Comment options

@MihaZupan
Comment options

Answer selected by MihaZupan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants