Ignore certificate errors for KeepAlive task. (#12019)

This commit is contained in:
Paul Johnson
2022-02-22 08:49:56 +00:00
committed by GitHub
parent 4f0a837e20
commit e67da0b198
3 changed files with 27 additions and 1 deletions

View File

@@ -3,6 +3,7 @@ using System.Data.Common;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Reflection;
using Dazinator.Extensions.FileProviders.GlobPatternFilter;
using Microsoft.AspNetCore.Builder;
@@ -191,6 +192,11 @@ namespace Umbraco.Extensions
private static IUmbracoBuilder AddHttpClients(this IUmbracoBuilder builder)
{
builder.Services.AddHttpClient();
builder.Services.AddHttpClient(Constants.HttpClients.IgnoreCertificateErrors)
.ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler
{
ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
});
return builder;
}