You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently using YARP to forward requests directly with MapForwarder, as well as through Duende BFF, which uses YARP internally.
I'm implementing a token exchange mechanism and need to intercept the request headers. I believe using the ITransformProvider would be suitable for this task, as it allows appending RequestTransform to the route.
However, I've encountered a problem: both MapForwarder and Duende BFF call the Create method, which does not execute any of the transform providers, as seen in the following code snippet: TransformBuilder.cs - Lines 139-179.
Currently, it appears that there's no way to apply a generic configuration across all YARP use cases. Overriding ITransformBuilder seems the only way, but the default implementation is internal which doesnt make this easier.
I think adding the ITransformProvider capabilities to the Create method would pretty much solve all of these issues.
What are your thoughts on this approach? Is there anything I might have overlooked?
Thank you!
The text was updated successfully, but these errors were encountered:
PascalSenn
changed the title
Integrate ITransformFactory with ITransformBuilder.Create Method
Integrate ITransformProvider with ITransformBuilder.Create Method
Oct 9, 2024
Essentially the difference is that ITransformProvider and ITransformBuilder.Build expect there to be a route definition, whereas Create does not.
The expectation was that the former would be used when you're using the routes/clusters configuration model and may need to adjust functionality depending on each route, and Create would be used when using direct forwarding to let you reuse transform logic (e.g. your class derived from RequestTransform) between the two, where it's unlikely that you'll have any transform providers registered.
As far as I can tell, BFF has an IHttpTransformerFactory interface where you could inject your transform, though that might mean duplicating any default logic they have there.
MapForwarder are very simple convenience APIs when you don't need a lot of customization, and there's an overload that lets you modify the TransformBuilderContext. Getting the desired behavior there might mean just adding the transform there.
As mentioned above, I don't think we expected Create to be used together with ITransformProvider, but I think it'd be fine if we changed the behavior here and called into providers (after creating a fake RouteConfig).
Hi there,
I'm currently using YARP to forward requests directly with
MapForwarder
, as well as through Duende BFF, which uses YARP internally.I'm implementing a token exchange mechanism and need to intercept the request headers. I believe using the ITransformProvider would be suitable for this task, as it allows appending
RequestTransform
to the route.However, I've encountered a problem: both
MapForwarder
and Duende BFF call the Create method, which does not execute any of the transform providers, as seen in the following code snippet:TransformBuilder.cs - Lines 139-179.
Currently, it appears that there's no way to apply a generic configuration across all YARP use cases. Overriding
ITransformBuilder
seems the only way, but the default implementation isinternal
which doesnt make this easier.I think adding the
ITransformProvider
capabilities to theCreate
method would pretty much solve all of these issues.What are your thoughts on this approach? Is there anything I might have overlooked?
Thank you!
The text was updated successfully, but these errors were encountered: