PenningtonRedirectMiddleware Pennington.Infrastructure
Issues HTTP 301 responses for URLs in RedirectContentService's merged redirect map (_redirects.yml + per-page redirectUrl: front matter). Runs before content routing so dev requests redirect cleanly; the static build crawler captures the same 301 response and OutputGenerationService writes the meta-refresh body to disk. One code path for dev and publish.
Constructors
.ctor
#public PenningtonRedirectMiddleware(RequestDelegate next);Initializes the middleware with the next delegate in the pipeline.
Parameters
nextRequestDelegate
Methods
InvokeAsync
#public async Task InvokeAsync(HttpContext context, RedirectContentService redirects);Issues a 301 when the request path matches the merged redirect map, otherwise calls the next delegate.
Parameters
contextHttpContextredirectsRedirectContentService
Returns
TaskPennington.Infrastructure.PenningtonRedirectMiddleware
namespace Pennington.Infrastructure;
/// Issues HTTP 301 responses for URLs in RedirectContentService's merged redirect map (_redirects.yml + per-page redirectUrl: front matter). Runs before content routing so dev requests redirect cleanly; the static build crawler captures the same 301 response and OutputGenerationService writes the meta-refresh body to disk. One code path for dev and publish.
public class PenningtonRedirectMiddleware
{
/// Initializes the middleware with the next delegate in the pipeline.
public PenningtonRedirectMiddleware(RequestDelegate next);
/// Issues a 301 when the request path matches the merged redirect map, otherwise calls the next delegate.
public async Task InvokeAsync(HttpContext context, RedirectContentService redirects);
}