Yarp-based Direct Forwarding Pattern

Photo by Joe Gardner on Unsplash

A reverse proxy can be used to spread out the work, make the system more secure, send traffic to a different upstream, and so on. However, in some cases, we only need to forward the request to the external system without making any changes. The direct forwarding pattern comes into play here.

General Use cases for this pattern

Since Yarp is a library for making a reverse proxy, any custom logic falls under the basic usage. So lets start with a Simple minimal dotnet6 Empty template

Following steps make the pattern possible

This pattern comes in handy when dealing with an external service that does the heavy lifting. For example, use the pattern if you want to show a file you downloaded from AWS S3 without using a pre-signed URL.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store