reverse-proxy
reverse-proxy copied to clipboard
What should be the route for passing Id as well.
Some details
How many backends are in your application?
- [ ] 1-2
Of all the examples I have seen, none of them showed how can I configure a route for something like api/EmployeesService/1
"route2": {
"ClusterId": "cluster2",
"Match": {
"Path": "/api/employeesservice/{Id}"
},
"Transforms": [
{
"PathRemovePrefix": "/api/employeesservice/{Id}"
}
]
}
},
"Clusters": {
"cluster2": {
"Destinations": {
"cluster2/destination2": {
"Address": "http://localhost:90/api/employees/{Id}"
}
}
}
}
I am still new in web programming. So please forgive me if this is a stupid question.
Try this: https://microsoft.github.io/reverse-proxy/articles/transforms.html#pathpattern
"route2": {
"ClusterId": "cluster2",
"Match": {
"Path": "/api/employeesservice/{id}"
},
"Transforms": [
{
"PathPattern": "/api/employees/{id}"
}
]
}
},
"Clusters": {
"cluster2": {
"Destinations": {
"cluster2/destination2": {
"Address": "http://localhost:90"
}
}
}
}
Or:
"route2": {
"ClusterId": "cluster2",
"Match": {
"Path": "/api/employeesservice/{**catch-all}"
},
"Transforms": [
{
"PathRemovePrefix": "/api/employeesservice"
},
{
"PathPrefix": "/api/employees"
}
]
}
},
"Clusters": {
"cluster2": {
"Destinations": {
"cluster2/destination2": {
"Address": "http://localhost:90"
}
}
}
}
thanks a lot :))