Eigenverft.WebLib.CanonicalHostRedirect 1.0.0.6-g40a2f17cdc

This is a prerelease version of Eigenverft.WebLib.CanonicalHostRedirect.
dotnet add package Eigenverft.WebLib.CanonicalHostRedirect --version 1.0.0.6-g40a2f17cdc
                    
NuGet\Install-Package Eigenverft.WebLib.CanonicalHostRedirect -Version 1.0.0.6-g40a2f17cdc
                    
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="Eigenverft.WebLib.CanonicalHostRedirect" Version="1.0.0.6-g40a2f17cdc" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Eigenverft.WebLib.CanonicalHostRedirect" Version="1.0.0.6-g40a2f17cdc" />
                    
Directory.Packages.props
<PackageReference Include="Eigenverft.WebLib.CanonicalHostRedirect" />
                    
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 Eigenverft.WebLib.CanonicalHostRedirect --version 1.0.0.6-g40a2f17cdc
                    
#r "nuget: Eigenverft.WebLib.CanonicalHostRedirect, 1.0.0.6-g40a2f17cdc"
                    
#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 Eigenverft.WebLib.CanonicalHostRedirect@1.0.0.6-g40a2f17cdc
                    
#: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=Eigenverft.WebLib.CanonicalHostRedirect&version=1.0.0.6-g40a2f17cdc&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Eigenverft.WebLib.CanonicalHostRedirect&version=1.0.0.6-g40a2f17cdc&prerelease
                    
Install as a Cake Tool

Eigenverft.WebLib.CanonicalHostRedirect

NuGet Version NuGet Downloads Repository CI Targets License

A small ASP.NET Core middleware that combines canonical host and HTTPS normalization in one permanent redirect.

✨ At a glance

Capability What it does
AddCanonicalHostRedirect / UseCanonicalHostRedirect Register configuration and add the redirect middleware.
CanonicalHostMode Choose the apex or www form for the primary host and aliases.
Dependency Uses Eigenverft.WebLib.Middleware.Primitives for isolated use-site options.

📦 Installation

dotnet add package Eigenverft.WebLib.CanonicalHostRedirect

🚀 Quick start

Canonicalize host and scheme

using Eigenverft.WebLib.CanonicalHostRedirect;
using Microsoft.AspNetCore.Builder;

builder.Services.AddCanonicalHostRedirect(options =>
    options.PrimaryApexHost = "example.com");

WebApplication app = builder.Build();
app.UseCanonicalHostRedirect();
app.Run();

Package behavior

The normal defaults canonicalize the primary host group to www, require HTTPS, return 308 Permanent Redirect, and use implicit HTTPS port 443. Set RedirectFromHosts for additional host aliases or Canonicalization = CanonicalHostMode.ToApex to use the apex host. HttpsTargetPort may select one HTTPS port for every redirect; null and 443 omit the port. Incoming HTTP ports are never copied into the HTTPS target.

The redirect preserves PathBase, path, and query and combines host and scheme changes into one hop. A host that is not the primary host or a listed alias keeps its host name and is still redirected to HTTPS. Already-canonical HTTPS requests continue through the pipeline.

AddCanonicalHostRedirect() binds the CanonicalHostRedirect configuration section. The overload with an Action applies code configuration after binding. The UseCanonicalHostRedirect(Action<CanonicalHostRedirectOptions>) overload applies a local override to only that middleware use; configuration reload rebuilds the baseline and reapplies that override.

Place ASP.NET Core UseForwardedHeaders() before this middleware when a trusted reverse proxy supplies the client-facing host or scheme. PrimaryApexHost and RedirectFromHosts must not contain ports; configure HttpsTargetPort instead. Configured target ports must be between 1 and 65535.

🎯 Target frameworks

Targets .NET 8 and .NET 10. A .NET 9 application can consume the compatible net8.0 asset.

📄 License

Licensed under the MIT License by Eigenverft.

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

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0.6-g40a2f17cdc 0 9/28/2026
1.0.0.6-g3f72d1412c 0 9/29/2026
1.0.0.3-gbfce1c5596 0 9/28/2026
1.0.0.3-g8afd56e9dc 0 9/12/2026

Initial capability package extracted from Eigenverft.WebLib.Infrastructure.

- ASP.NET Core middleware for redirecting requests to a configured canonical host with configurable redirect behavior.
- Public namespaces and behavior remain compatible with the original Infrastructure implementation.