Building a Reverse Proxy in .NET Core

My apologies - I’m probably confusing things. To your credit, as this is one of the few (if not only directly visible) examples of a basic C# reverse-proxy ( :+1: ), I was suggesting the two additions, to help it lean to a more generic audience/example, as I was conscious that there is probably a lot of people like me, who are interested in a more foundational template that could apply in more scenarios (if not more quickly grow into any usage). I might not be aware/have included some technicality, but I found that with these two additions the sample was working fairly well for me (for .NET 6 at least).

I.E. (For .NET 6 at least) I seemed to need to manually copy the content length & type, as well as to capture the non-Content headers (such as the ‘Authorization’ header being a typical/commonplace example).

(Hopefully the fact that I’ve recorded the possible need for these two changes might be good enough for others who want to try the sample against .NET 6 with any & all usages - it might just work better ‘out of the box’/with no immediate/additional tweaks; possibly more generic/immediate fun with least investment/code-change.)

Thanks for your suggestions @DennisVM-D2i.
Actually, the goal of the article was to give a general idea about creating a custom reverse proxy in C#.
I will take into account your suggestions for a possible update. Thanks again :pray:

1 Like

Your article is excellent. But can you consider providing a solution for .netcore 7? I tried to run the example in .netCore 7 but without success.

Hey @dakolundz,
Welcome to the Auth0 Community!

Thank you for appreciating my article :pray: It was written a long time ago, with a few fixes along the way, but its original intent was not to provide a working solution, but to show the general principles of how a reverse proxy can be built in .NET.
In other words, this article will not be updated to newer versions of .NET but the general idea is still valid.
If you want an up-to-date working reverse proxy built in .NET, I suggest you take a look at the YARP project.

1 Like