Reputation: 803
Do we have any setting option in MS Yarp to send http put/post requests to one cluster and http get to different cluster?
Or any way to apply different header transformation for http put/post and get request?
In this example I am trying to forward the post to createuserapicluster and get to different cluster getuserapicluster
"ReverseProxy": {
"Routes": [
{
"RouteId": "user1",
"ClusterId": "createuserapicluster",
"Match": {
"Path": "/api/users/{**catch-all}"
},
"Transforms": [
{
"PathRemovePrefix": "/api/users"
}
]
},
{
"RouteId": "user2",
"ClusterId": "getuserapicluster",
"Match": {
"Path": "/api/users/{**catch-all}"
},
"Transforms": [
{
"PathRemovePrefix": "/api/users"
}
]
}
],
"Clusters": {
"createuserapicluster": {
"Destinations": {
"destination1": {
"Address": "https://localhost:8080"
}
}
},
"getuserapicluster": {
"Destinations": {
"Destination1": {
"Address": "https://localhost:9090/"
}
}
}
}
}
Upvotes: 0
Views: 819
Reputation: 6094
Yes, you can match routes based on Method. See https://microsoft.github.io/reverse-proxy/articles/config-files.html
"Match": { "Path": "/something/{**remainder}", "Methods" : [ "GET", "POST" ],
Upvotes: 1