-
Is it possible to select a route based on the E.g. a request for It seems a problem will be that Authorization is predicated on routing in YARP which seems to create a catch-22. My middleware must run before routing, but it needs the authenticated identity, which is only known after routing. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Nothing built in, though there are manual ways you could do it. See: Part of the problem is that the type of auth to be performed can be specified per route in aspnetcore, so auth happens after routing. Do you have auth setup so that it happens before requests and is route independent? |
Beta Was this translation helpful? Give feedback.
-
I ran into something similar again this week. We're a multi-tenant platform one use-case for our YARP gateway is that we want to connect a tenant to an external multi-tenant API that uses client-certificate authentication. In this case we want to configure one endpoint on the proxy, configure a tenant-certificate mapping and have the outgoing TLS connection use the specific tenant's client certificate for proxied requests coming from that tenant. |
Beta Was this translation helpful? Give feedback.
Nothing built in, though there are manual ways you could do it. See:
https://github.com/dotnet/yarp/blob/5e0bbb4375b1385ff6a7cafe47fb6217854656d2/samples/ReverseProxy.Direct.Sample/README.md
Or
yarp/src/ReverseProxy/Model/HttpContextFeaturesExtensions.cs
Line 49 in 5e0bbb4
Part of the problem is that the type of auth to be performed can be specified per route in aspnetcore, so auth happens after routing.
Do you have auth setup so that it happens before requests and is route independent?