/// <summary> /// Adds middleware to check if the selected destination should use Http.sys delegation. /// If so, the request is delegated to the destination queue instead of being proxied over HTTP. /// This should be placed after load balancing and passive health checks. /// </summary> /// <remarks> /// This middleware only works with the ASP.NET Core Http.sys server implementation. /// </remarks> public static IReverseProxyApplicationBuilder UseHttpSysDelegation(this IReverseProxyApplicationBuilder builder) { // IServerDelegationFeature isn't added to DI https://github.com/dotnet/aspnetcore/issues/40043 _ = builder.ApplicationServices.GetRequiredService <IServer>().Features?.Get <IServerDelegationFeature>() ?? throw new NotSupportedException($"{typeof(IHttpSysRequestDelegationFeature).FullName} is not available. Http.sys delegation is only supported when using the Http.sys server"); builder.UseMiddleware <HttpSysDelegatorMiddleware>(); return(builder); }
/// <summary> /// Load balances across the available endpoints. /// </summary> public static IReverseProxyApplicationBuilder UseLoadBalancing(this IReverseProxyApplicationBuilder builder) { builder.UseMiddleware <LoadBalancingMiddleware>(); return(builder); }
/// <summary> /// Passively checks destinations health by watching for successes and failures in client request proxying. /// </summary> public static IReverseProxyApplicationBuilder UsePassiveHealthChecks(this IReverseProxyApplicationBuilder builder) { builder.UseMiddleware <PassiveHealthCheckMiddleware>(); return(builder); }
/// <summary> /// Checks if a request has an established affinity relationship and if the associated destination is available. /// This should be placed before load balancing and other destination selection components. /// Requests without an affinity relationship will be processed normally and have the affinity relationship /// established by a later component. /// </summary> public static IReverseProxyApplicationBuilder UseSessionAffinity(this IReverseProxyApplicationBuilder builder) { builder.UseMiddleware <SessionAffinityMiddleware>(); return(builder); }