Post-Transformed Path from Middleware #1513
-
How would you get the proxied/post-transformed path (not necessarily the full URL) from within custom middleware? For example, suppose the following configuration: {
"Routes": {
"my-route": {
"ClusterId": "my-cluster",
"Match": {
"Path": "/path/{**catch-all}"
},
"Transforms": [
{
"PathRemovePrefix": "/path"
},
{
"PathPrefix": "/api"
}
]
}
},
"Clusters": {
"my-cluster": {
"Destinations": {
"destination": {
"Address": "http://my.backend.svc/"
}
}
}
}
} An incoming path of the form app.UseEndpoints(endpoints =>
{
endpoints.MapReverseProxy(proxy =>
{
proxy.Use(async (ctx, next) =>
{
// How to get the transformed path here?
var tranformedPath = ...;
await next();
});
proxy.UseSessionAffinity();
proxy.UseLoadBalancing();
proxy.UsePassiveHealthChecks();
});
}); |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Asp.Net middleware don't have access to that, the transformed request path only exists on the outbound HttpRequestMessage. You can capture it in a custom transform or in a DelegatingHandler |
Beta Was this translation helpful? Give feedback.
Asp.Net middleware don't have access to that, the transformed request path only exists on the outbound HttpRequestMessage. You can capture it in a custom transform or in a DelegatingHandler