Fhi.ReverseProxyMiddleware
0.0.9
dotnet add package Fhi.ReverseProxyMiddleware --version 0.0.9
NuGet\Install-Package Fhi.ReverseProxyMiddleware -Version 0.0.9
<PackageReference Include="Fhi.ReverseProxyMiddleware" Version="0.0.9" />
<PackageVersion Include="Fhi.ReverseProxyMiddleware" Version="0.0.9" />
<PackageReference Include="Fhi.ReverseProxyMiddleware" />
paket add Fhi.ReverseProxyMiddleware --version 0.0.9
#r "nuget: Fhi.ReverseProxyMiddleware, 0.0.9"
#:package Fhi.ReverseProxyMiddleware@0.0.9
#addin nuget:?package=Fhi.ReverseProxyMiddleware&version=0.0.9
#tool nuget:?package=Fhi.ReverseProxyMiddleware&version=0.0.9
Fhi.ReverseProxyMiddleware
Handles reverse proxy if you just need to route api-calls through without doing anything more about them
Setup example
Create a new asp.net web minimal api project
dotnet new web -o TodoApi
Add a httpClient in program.cs
builder.Services.AddHttpClient("httpClientName", c =>
{
c.BaseAddress = new Uri("https://urlToApi");
});
Add this package
dotnet add package fhi.reverseproxymiddleware
Add configuration in appsettings.json. TargetPath will be what you want to reverse proxy; ie if your site is hosted on https://localhost, with the configuration below, all calls to https://localhost/api will be forwarded to the using the httpClient with the specified name.
AllowedHttpMethods are the methods you want to reverse proxy, by default all are included
"ReverseProxyOptions": {
"HttpClientName": "httpClientName",
"TargetPath": "api",
"AllowedHttpMethods": "get;post;put",
"IncludeTargetPath": "true"
}
Add options and middleware into program.cs
var reverseProxyOptions = builder.Configuration.GetSection("ReverseProxyOptions").Get<ReverseProxyOptions>()!;
...
app.UseMiddleware<ReverseProxyMiddleware>(Options.Create(reverseProxyOptions));
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
-
net8.0
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Microsoft.Extensions.Http (>= 8.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.