JorgeCostaMacia.Http.ForwardedHeaders 5.1.1

Prefix Reserved
dotnet add package JorgeCostaMacia.Http.ForwardedHeaders --version 5.1.1
                    
NuGet\Install-Package JorgeCostaMacia.Http.ForwardedHeaders -Version 5.1.1
                    
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="JorgeCostaMacia.Http.ForwardedHeaders" Version="5.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="JorgeCostaMacia.Http.ForwardedHeaders" Version="5.1.1" />
                    
Directory.Packages.props
<PackageReference Include="JorgeCostaMacia.Http.ForwardedHeaders" />
                    
Project file
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 JorgeCostaMacia.Http.ForwardedHeaders --version 5.1.1
                    
#r "nuget: JorgeCostaMacia.Http.ForwardedHeaders, 5.1.1"
                    
#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 JorgeCostaMacia.Http.ForwardedHeaders@5.1.1
                    
#: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=JorgeCostaMacia.Http.ForwardedHeaders&version=5.1.1
                    
Install as a Cake Addin
#tool nuget:?package=JorgeCostaMacia.Http.ForwardedHeaders&version=5.1.1
                    
Install as a Cake Tool

JorgeCostaMacia.Http.ForwardedHeaders

Forwarded-headers defaults for a service behind a reverse proxy — an options extension that trusts the proxy on the same host or on Docker's default bridge and honours its X-Forwarded-* headers, keeping the framework's Configure<ForwardedHeadersOptions> and UseForwardedHeaders calls visible in your Program.

NuGet Downloads Build License


Install

dotnet add package JorgeCostaMacia.Http.ForwardedHeaders

Usage

using JorgeCostaMacia.Http.ForwardedHeaders.Infrastructure;

builder.Services.Configure<ForwardedHeadersOptions>(options => options.WithDefaults());

var app = builder.Build();

app.UseForwardedHeaders();   // first in the pipeline, so everything after sees the client's address and scheme

Honours X-Forwarded-For, X-Forwarded-Proto and X-Forwarded-Host, and only from a trusted address: the loopbacks (127.0.0.1, 127.0.1.1, ::1) and Docker's default bridge (172.17.0.0/16), the network a proxy on the host reaches a published container from. Headers sent by anyone else are ignored, so a client cannot forge its address or scheme.

The trusted addresses are added to the framework's own. A service behind another proxy adds it after the defaults:

builder.Services.Configure<ForwardedHeadersOptions>(options =>
{
    options.WithDefaults();
    options.KnownProxies.Add(IPAddress.Parse("10.0.0.5"));
});

Requirements

The .NET 10 SDK.

Depends on the ASP.NET Core shared framework only.

About

JorgeCostaMacia.Http.ForwardedHeaders is part of http-dotnet — extensions for ASP.NET Core, each scoped to a single concern and reusable across your services. An independent project, not affiliated with Microsoft or the ASP.NET Core project.

Author: Jorge Costa Maciá

Product 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.

Version Downloads Last Updated
5.1.1 116 11/9/2026
5.1.0 92 11/8/2026
5.0.1 91 11/8/2026
5.0.0 87 11/8/2026
4.1.8 155 10/27/2026
4.1.7 100 10/27/2026
4.1.6 124 10/22/2026
4.1.5 98 10/22/2026
4.1.4 116 10/16/2026
4.1.3 97 10/14/2026
4.1.2 109 10/12/2026
4.1.1 97 10/8/2026
4.1.0 110 10/7/2026