File tree 2 files changed +24
-1
lines changed
2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+
4
+ namespace Yarp . ReverseProxy . Delegation ;
5
+
6
+ // Only used as part of a workaround for https://github.com/dotnet/aspnetcore/issues/59166.
7
+ internal sealed class DummyHttpSysDelegator : IHttpSysDelegator
8
+ {
9
+ public void ResetQueue ( string queueName , string urlPrefix ) { }
10
+ }
Original file line number Diff line number Diff line change 10
10
using Microsoft . Extensions . Logging ;
11
11
using Yarp . ReverseProxy . Configuration ;
12
12
using Yarp . ReverseProxy . Configuration . ConfigProvider ;
13
+ using Yarp . ReverseProxy . Delegation ;
13
14
using Yarp . ReverseProxy . Forwarder ;
14
15
using Yarp . ReverseProxy . Management ;
15
16
using Yarp . ReverseProxy . Routing ;
@@ -52,10 +53,22 @@ public static IReverseProxyBuilder AddReverseProxy(this IServiceCollection servi
52
53
. AddActiveHealthChecks ( )
53
54
. AddPassiveHealthCheck ( )
54
55
. AddLoadBalancingPolicies ( )
55
- . AddHttpSysDelegation ( )
56
56
. AddDestinationResolver ( )
57
57
. AddProxy ( ) ;
58
58
59
+ if ( OperatingSystem . IsWindows ( ) )
60
+ {
61
+ // Workaround for https://github.com/dotnet/aspnetcore/issues/59166.
62
+ // .NET 9.0 packages for Ubuntu ship a broken Microsoft.AspNetCore.Server.HttpSys assembly.
63
+ // Avoid loading types from that assembly on Linux unless the user explicitly tries to do so.
64
+ builder . AddHttpSysDelegation ( ) ;
65
+ }
66
+ else
67
+ {
68
+ // Add a no-op delegator in case someone is injecting the interface in their cross-plat logic.
69
+ builder . Services . TryAddSingleton < IHttpSysDelegator , DummyHttpSysDelegator > ( ) ;
70
+ }
71
+
59
72
services . TryAddSingleton < ProxyEndpointFactory > ( ) ;
60
73
61
74
services . AddDataProtection ( ) ;
You can’t perform that action at this time.
0 commit comments