From 266ea18c9d7bb3865358e7c5733d82c151a9549a Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 28 Dec 2025 06:18:54 +0000 Subject: [PATCH] fix: Add SSL certificate bypass for localhost in upload dialog - Fix SSL connection errors when testing localhost URLs with self-signed certificates - Apply certificate validation bypass to both Test URL and Upload functionality - Support localhost, 127.0.0.1, and private network IP ranges (192.168.x.x, 10.x.x.x, 172.x.x.x) - Resolves "The SSL connection could not be established" error when using Test URL button with https://localhost --- Intersect.Editor/Forms/FrmUploadToServer.cs | 31 +++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/Intersect.Editor/Forms/FrmUploadToServer.cs b/Intersect.Editor/Forms/FrmUploadToServer.cs index 83de87ea8e..09c9c73037 100644 --- a/Intersect.Editor/Forms/FrmUploadToServer.cs +++ b/Intersect.Editor/Forms/FrmUploadToServer.cs @@ -681,7 +681,20 @@ private async Task PerformUpload() var totalFiles = files.Length; var uploadedFiles = 0; - using var httpClient = new HttpClient + // Create HTTP client with SSL bypass for localhost + var handler = new HttpClientHandler(); + var uri = new Uri(serverUrl); + if (uri.Host.Equals("localhost", StringComparison.OrdinalIgnoreCase) || + uri.Host == "127.0.0.1" || + uri.Host.StartsWith("192.168.") || + uri.Host.StartsWith("10.") || + uri.Host.StartsWith("172.")) + { + // Bypass SSL validation for local/private network addresses + handler.ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => true; + } + + using var httpClient = new HttpClient(handler) { Timeout = TimeSpan.FromMinutes(30) }; @@ -819,7 +832,21 @@ private async void btnTestUrl_Click(object sender, EventArgs e) try { var serverUrl = txtServerUrl.Text.TrimEnd('/'); - using var httpClient = new HttpClient + + // Create HTTP client with SSL bypass for localhost + var handler = new HttpClientHandler(); + var uri = new Uri(serverUrl); + if (uri.Host.Equals("localhost", StringComparison.OrdinalIgnoreCase) || + uri.Host == "127.0.0.1" || + uri.Host.StartsWith("192.168.") || + uri.Host.StartsWith("10.") || + uri.Host.StartsWith("172.")) + { + // Bypass SSL validation for local/private network addresses + handler.ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => true; + } + + using var httpClient = new HttpClient(handler) { Timeout = TimeSpan.FromSeconds(10) };