DamianH.Http.ForwardProxy
0.2.0
dotnet add package DamianH.Http.ForwardProxy --version 0.2.0
NuGet\Install-Package DamianH.Http.ForwardProxy -Version 0.2.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DamianH.Http.ForwardProxy" Version="0.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DamianH.Http.ForwardProxy" Version="0.2.0" />
<PackageReference Include="DamianH.Http.ForwardProxy" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DamianH.Http.ForwardProxy --version 0.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: DamianH.Http.ForwardProxy, 0.2.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package DamianH.Http.ForwardProxy@0.2.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DamianH.Http.ForwardProxy&version=0.2.0
#tool nuget:?package=DamianH.Http.ForwardProxy&version=0.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
DamianH.Http.ForwardProxy
An HTTP forward (egress) proxy for ASP.NET Core and Kestrel on .NET 10. Clients
configure it as their proxy (HTTPS_PROXY, HttpClient.Proxy, curl --proxy)
to reach arbitrary destinations, subject to your authentication, authorization
and destination rules.
- HTTP/1.1
CONNECTtunnels (connection middleware) and HTTP/2CONNECTtunnels (RFC 9113 §8.5). - Absolute-form
http://forwarding, including WebSocket upgrades. No reverse-proxy package dependency; the forwarding core is adapted from YARP (MIT, seeTHIRD-PARTY-NOTICES.txt). - Proxy authentication through ASP.NET Core authentication handlers and
authorization policies, with
407/Proxy-Authenticate. AProxyBasichandler is included. - Secure by default: only ports 443 (
CONNECT) and 80 (http://), and private, loopback, link-local (cloud metadata) and other non-public addresses are blocked after DNS resolution, so DNS rebinding cannot bypass them. - Optional TLS interception of selected
CONNECTtunnels (HTTP/1.1 and HTTP/2) with your own certificate provider, so middleware or request transforms can modify requests, for example to inject credentials. - Optional per-request upstream client-certificate selection for intercepted HTTPS requests, with certificate-isolated connection pooling for mTLS.
- RFC 9209
Proxy-Statuserrors,Via, logs, metrics and traces.
Installation
dotnet add package DamianH.Http.ForwardProxy
Quick start
using DamianH.Http.ForwardProxy;
using DamianH.Http.ForwardProxy.Authentication;
using Microsoft.AspNetCore.Authorization;
var builder = WebApplication.CreateBuilder(args);
builder.WebHost.ConfigureKestrel(kestrel => kestrel.ListenAnyIP(8080, listen =>
{
listen.UseForwardProxy(); // HTTP/1.1 CONNECT
}));
builder.Services.AddAuthentication().AddProxyBasic(options =>
{
options.ValidateCredentials = (context, user, password) => ValidateAsync(user, password);
});
builder.Services.AddForwardProxy(options =>
{
options.AuthorizationPolicy = new AuthorizationPolicyBuilder(ProxyBasicDefaults.AuthenticationScheme)
.RequireAuthenticatedUser()
.Build();
});
var app = builder.Build();
app.UseForwardProxy(); // http:// forwarding and HTTP/2 CONNECT; before routing and auth middleware
app.MapGet("/healthz", () => "ok");
app.Run();
curl --proxy http://user:password@localhost:8080 https://example.com/
Without an authorization policy the proxy is open to anyone who can reach it and logs a warning at startup. Never expose an open proxy to the internet.
Documentation
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.