ApiVersioning.AspNetCore
1.0.1
dotnet add package ApiVersioning.AspNetCore --version 1.0.1
NuGet\Install-Package ApiVersioning.AspNetCore -Version 1.0.1
<PackageReference Include="ApiVersioning.AspNetCore" Version="1.0.1" />
<PackageVersion Include="ApiVersioning.AspNetCore" Version="1.0.1" />
<PackageReference Include="ApiVersioning.AspNetCore" />
paket add ApiVersioning.AspNetCore --version 1.0.1
#r "nuget: ApiVersioning.AspNetCore, 1.0.1"
#:package ApiVersioning.AspNetCore@1.0.1
#addin nuget:?package=ApiVersioning.AspNetCore&version=1.0.1
#tool nuget:?package=ApiVersioning.AspNetCore&version=1.0.1
ApiVersioning.AspNetCore
ASP.NET Core middleware that redirects unversioned /api/ requests to /api/v1/ (or a configured
default version) using a 308 Permanent Redirect — preserving the HTTP method and request body
(unlike 301/302, which may downgrade POST to GET).
Every service in the platform exposes versioned endpoints under /api/v1/... but wants unversioned
/api/... callers to be forwarded transparently. This package standardizes that contract with one
line of setup, replacing the ~29-line ApiVersionRedirectMiddleware.cs copy that was hand-rolled in
each service.
Installation
dotnet add package ApiVersioning.AspNetCore
Quick Start
using ApiVersioning.AspNetCore.Extensions;
// Register BEFORE endpoint routing / FastEndpoints so it matches ahead of the versioned handlers.
app.UseApiVersionRedirect();
Exempting stable, unversioned paths (e.g. webhooks)
External webhook callbacks (Stripe, etc.) sit on a stable unversioned URL and do not follow redirects — a 308 would silently swallow the event. Exempt them:
app.UseApiVersionRedirect(o => o.ExemptPathPrefixes = ["/api/webhooks/"]);
Options
| Option | Default | Purpose |
|---|---|---|
DefaultVersion |
v1 |
Version segment inserted after /api. |
StatusCode |
308 |
Redirect status. 308 preserves method + body. |
ExemptPathPrefixes |
[] |
/api/ sub-prefixes that must NOT be redirected. |
Behaviour
/api/surveys→308→Location: /api/v1/surveys(query string preserved)./api/v1/surveys→ passes through (already versioned)./health,/swagger, non-/api/paths → pass through.- Matching is case-insensitive.
License
MIT
| 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. |
-
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 |
|---|---|---|
| 1.0.1 | 404 | 7/1/2026 |