diff --git a/docs/docfx/articles/direct-forwarding.md b/docs/docfx/articles/direct-forwarding.md index 656e10680..5d8d62cc9 100644 --- a/docs/docfx/articles/direct-forwarding.md +++ b/docs/docfx/articles/direct-forwarding.md @@ -52,7 +52,8 @@ public void Configure(IApplicationBuilder app, IHttpForwarder forwarder) AllowAutoRedirect = false, AutomaticDecompression = DecompressionMethods.None, UseCookies = false, - ActivityHeadersPropagator = new ReverseProxyPropagator(DistributedContextPropagator.Current) + ActivityHeadersPropagator = new ReverseProxyPropagator(DistributedContextPropagator.Current), + ConnectTimeout = TimeSpan.FromSeconds(15), }); var transformer = new CustomTransformer(); // or HttpTransformer.Default; var requestConfig = new ForwarderRequestConfig { ActivityTimeout = TimeSpan.FromSeconds(100) }; diff --git a/docs/docfx/articles/http-client-config.md b/docs/docfx/articles/http-client-config.md index 22742abd0..8af4b5975 100644 --- a/docs/docfx/articles/http-client-config.md +++ b/docs/docfx/articles/http-client-config.md @@ -209,7 +209,8 @@ new SocketsHttpHandler AllowAutoRedirect = false, AutomaticDecompression = DecompressionMethods.None, UseCookies = false, - ActivityHeadersPropagator = new ReverseProxyPropagator(DistributedContextPropagator.Current) + ActivityHeadersPropagator = new ReverseProxyPropagator(DistributedContextPropagator.Current), + ConnectTimeout = TimeSpan.FromSeconds(15), }; ``` diff --git a/samples/ReverseProxy.Direct.Sample/Startup.cs b/samples/ReverseProxy.Direct.Sample/Startup.cs index c1993c73e..45d75197c 100644 --- a/samples/ReverseProxy.Direct.Sample/Startup.cs +++ b/samples/ReverseProxy.Direct.Sample/Startup.cs @@ -41,6 +41,7 @@ public void Configure(IApplicationBuilder app, IHttpForwarder forwarder) AutomaticDecompression = DecompressionMethods.None, UseCookies = false, ActivityHeadersPropagator = new ReverseProxyPropagator(DistributedContextPropagator.Current), + ConnectTimeout = TimeSpan.FromSeconds(15), }); // Setup our own request transform class diff --git a/src/ReverseProxy/Forwarder/ForwarderHttpClientFactory.cs b/src/ReverseProxy/Forwarder/ForwarderHttpClientFactory.cs index 5c322a346..63430f7ba 100644 --- a/src/ReverseProxy/Forwarder/ForwarderHttpClientFactory.cs +++ b/src/ReverseProxy/Forwarder/ForwarderHttpClientFactory.cs @@ -48,6 +48,7 @@ public HttpMessageInvoker CreateClient(ForwarderHttpClientContext context) AutomaticDecompression = DecompressionMethods.None, UseCookies = false, ActivityHeadersPropagator = new ReverseProxyPropagator(DistributedContextPropagator.Current), + ConnectTimeout = TimeSpan.FromSeconds(15), // NOTE: MaxResponseHeadersLength = 64, which means up to 64 KB of headers are allowed by default as of .NET Core 3.1. }; diff --git a/testassets/ReverseProxy.Direct/Startup.cs b/testassets/ReverseProxy.Direct/Startup.cs index b5052d5f6..91755ba96 100644 --- a/testassets/ReverseProxy.Direct/Startup.cs +++ b/testassets/ReverseProxy.Direct/Startup.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using System; +using System.Diagnostics; using System.Net; using System.Net.Http; using System.Threading.Tasks; @@ -37,7 +38,9 @@ public void Configure(IApplicationBuilder app) UseProxy = false, AllowAutoRedirect = false, AutomaticDecompression = DecompressionMethods.None, - UseCookies = false + UseCookies = false, + ActivityHeadersPropagator = new ReverseProxyPropagator(DistributedContextPropagator.Current), + ConnectTimeout = TimeSpan.FromSeconds(15), }); var transformBuilder = app.ApplicationServices.GetRequiredService();