diff --git a/IRaCIS.Core.Application/Helper/OSSService.cs b/IRaCIS.Core.Application/Helper/OSSService.cs index 419369dea..0a888c09f 100644 --- a/IRaCIS.Core.Application/Helper/OSSService.cs +++ b/IRaCIS.Core.Application/Helper/OSSService.cs @@ -13,6 +13,7 @@ using Microsoft.Extensions.Options; using Minio; using Minio.DataModel.Args; using Newtonsoft.Json; +using System.Net; using System.Reactive.Linq; using System.Runtime.InteropServices; @@ -313,11 +314,18 @@ public class OSSService : IOSSService } else if (ObjectStoreServiceOptions.ObjectStoreUse == "MinIO") { + + var httpClientHandler = new HttpClientHandler + { + ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator + }; + var minIOConfig = ObjectStoreServiceOptions.MinIO; var minioClient = new MinioClient().WithEndpoint($"{minIOConfig.EndPoint}:{minIOConfig.Port}") .WithCredentials(minIOConfig.AccessKeyId, minIOConfig.SecretAccessKey).WithSSL(minIOConfig.UseSSL) + .WithHttpClient(new HttpClient(httpClientHandler)) .Build(); var putObjectArgs = new PutObjectArgs() @@ -390,12 +398,20 @@ public class OSSService : IOSSService } else if (ObjectStoreServiceOptions.ObjectStoreUse == "MinIO") { + + var httpClientHandler = new HttpClientHandler + { + ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator + }; + var minIOConfig = ObjectStoreServiceOptions.MinIO; var minioClient = new MinioClient().WithEndpoint($"{minIOConfig.EndPoint}:{minIOConfig.Port}") .WithCredentials(minIOConfig.AccessKeyId, minIOConfig.SecretAccessKey).WithSSL(minIOConfig.UseSSL) + .WithHttpClient(new HttpClient(httpClientHandler)) .Build(); + var getObjectArgs = new GetObjectArgs() .WithBucket(minIOConfig.BucketName) .WithObject(ossRelativePath)