-
I have a simple scenario: during application startup I configure SwaggerUI to point to existing swagger docs in my downstream services. (No, I'm not using I add endpoints to my documents by calling For time being I'm using My config looks like this: "ReverseProxy": {
"Routes": {
"todolistservice-route": {
"ClusterId": "todolistservice-cluster",
"Match": {
"Path": "/todolistservice/{**catch-all}"
},
"Transforms": [
{
"PathRemovePrefix": "/todolistservice",
"PathPrefix": "/api",
}
]
}
},
"Clusters": {
"todolistservice-cluster": {
"Destinations": {
"todolistservice-destination-1": {
"Address": "http://todolistservice:8080",
"Metadata": {
"SwaggerPath": "/swagger/v1/swagger.json"
}
}
}
}
}
} Problem is, I have to manually work with Is there any helper classes for generating relative URL to specified cluster+path? Like UrlHelper class from MVC? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You might find Assuming you're trying to get the base Url based on the route match, I'm not sure there's something built-in that would go in reverse and generate a Url that would match a given route. Re: |
Beta Was this translation helpful? Give feedback.
You might find
RequestUtilities.MakeDestinationAddress
helpful for the concat part.Assuming you're trying to get the base Url based on the route match, I'm not sure there's something built-in that would go in reverse and generate a Url that would match a given route.
If you have a pattern of setting up routes in a similar way, you could consider looking for the
PathRemovePrefix
transform instead, maybe saving yourself from dealing with wildcards.Re:
IProxyConfigProvider
, you might find usingIProxyStateLookup
easier (resolve it from DI) to look through routes/clusters.