Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/ReverseProxy/Delegation/DummyHttpSysDelegator.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

namespace Yarp.ReverseProxy.Delegation;

// Only used as part of a workaround for https://github.com/dotnet/aspnetcore/issues/59166.
internal sealed class DummyHttpSysDelegator : IHttpSysDelegator
{
public void ResetQueue(string queueName, string urlPrefix) { }
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Microsoft.Extensions.Logging;
using Yarp.ReverseProxy.Configuration;
using Yarp.ReverseProxy.Configuration.ConfigProvider;
using Yarp.ReverseProxy.Delegation;
using Yarp.ReverseProxy.Forwarder;
using Yarp.ReverseProxy.Management;
using Yarp.ReverseProxy.Routing;
Expand Down Expand Up @@ -52,10 +53,22 @@ public static IReverseProxyBuilder AddReverseProxy(this IServiceCollection servi
.AddActiveHealthChecks()
.AddPassiveHealthCheck()
.AddLoadBalancingPolicies()
.AddHttpSysDelegation()
.AddDestinationResolver()
.AddProxy();

if (OperatingSystem.IsWindows())
{
// Workaround for https://github.com/dotnet/aspnetcore/issues/59166.
// .NET 9.0 packages for Ubuntu ship a broken Microsoft.AspNetCore.Server.HttpSys assembly.
// Avoid loading types from that assembly on Linux unless the user explicitly tries to do so.
builder.AddHttpSysDelegation();
}
else
{
// Add a no-op delegator in case someone is injecting the interface in their cross-plat logic.
builder.Services.TryAddSingleton<IHttpSysDelegator, DummyHttpSysDelegator>();
}

services.TryAddSingleton<ProxyEndpointFactory>();

services.AddDataProtection();
Expand Down
Loading