Unobtanium.Web.Proxy is not written in modern C#, using Kestrel (you know the low-level http(s) server after dotnet). With some proxy specifications at hand, I managed to built a WAY less complex http proxy. That is also blazing fast.
During the design of this rewrite I kept the reboot ideas in mind, and I think I ticked all the boxes.
💥 everything changed, your code is definitely broken 💣
Check-out the worker example, to get a feeling for the new api.
In short, you now have 3 points where you can influence the proxy:
- ShouldDecryptNewConnection where you get the hostname and can decide to passthrough or to intercept the request
- OnRequest which will be called for each incoming intercepted request. Three options, modify request, generate response or do nothing.
- OnResponse allows you to change the response from the backend (or do nothing)
There are some interfaces, with default implementations if not implemented yourself. All http traffic is intercepted by default (because it does not really matter). For https traffic you’re able to decide whether or not to intercept the traffic.
Https passthrough will just forward the request as is, without decrypting the ssl stream.
Reboot focus
net8.0only (no support for older versions of .NET!)- Support for
ILoggerSee #4 - Support for diagnostic events using
ActivitySourceandActivitySee #3 - Using the latest .NET features like
Span<T>andMemory<T>to improve performance - Update dependencies to the latest versions
TLS 1.2andTLS 1.3only support- Modern Event System: Event-handlers with
HttpRequestMessageandHttpResponseMessage, to greatly improve the portability of the library See #6 HttpClientas the default client, and using the IHttpClientFactory to handle pooling of the clients- Testing, testing, testing!
Full Changelog: v0.9.1-beta.1...v0.9.1-beta.2