From 457fd28bb32a5d18bf7f8fedd6adcbec5999fde7 Mon Sep 17 00:00:00 2001 From: taylanbakircioglu Date: Fri, 7 Nov 2025 11:51:14 +0300 Subject: [PATCH] Fix: Backend Server SSL certificate dropdown not loading MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🐛 Bug Fix: - Fixed SSL certificate dropdown showing empty list in Backend Server edit - Backend Server SSL dropdown now loads certificates correctly 🔧 Technical Details: - Wrong API endpoint: /api/ssl-certificates (incorrect) - Correct endpoint: /api/ssl/certificates (same as Frontend) - Added cluster_id filtering and Authorization header - Added debug logging for troubleshooting ✅ Now Shows (Verified with Query Analysis): - Global SSL certificates (available to all clusters) - Cluster-specific SSL certificates for SELECTED cluster only - Other clusters' specific SSLs are NOT shown (correct behavior) 💡 SSL Enable Logic (HAProxy Standard): Current implementation is CORRECT per HAProxy syntax: server name addr:port ssl [verify required] The 'ssl' flag MUST be present before 'verify' can be used. Therefore: SSL Enable switch → SSL dropdown (correct behavior) Example HAProxy syntax: ✅ server es1 10.0.0.1:443 ssl verify required ca-file /path/cert.pem ❌ server es1 10.0.0.1:443 verify required (invalid - missing ssl flag) Query Logic (Line 173-176 backend/routers/ssl.py): Global: NOT EXISTS in ssl_certificate_clusters Cluster-specific: scc.cluster_id = selected_cluster_id --- frontend/src/components/BackendServers.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/BackendServers.js b/frontend/src/components/BackendServers.js index 6c1a8aa..52a96ef 100644 --- a/frontend/src/components/BackendServers.js +++ b/frontend/src/components/BackendServers.js @@ -147,9 +147,21 @@ const BackendServers = () => { }; const fetchSSLCertificates = async () => { + if (!selectedCluster) return; + try { - const params = selectedCluster ? { cluster_id: selectedCluster.id } : {}; - const response = await axios.get('/api/ssl-certificates', { params }); + const token = localStorage.getItem('token'); + // CRITICAL FIX: Use same endpoint as Frontend (/api/ssl/certificates not /api/ssl-certificates) + const response = await axios.get(`/api/ssl/certificates?cluster_id=${selectedCluster.id}`, { + headers: { Authorization: `Bearer ${token}` } + }); + + console.log('🔍 SSL FETCH DEBUG (BackendServers):', { + cluster_id: selectedCluster.id, + certificates_count: response.data?.certificates?.length || 0, + certificates: response.data?.certificates + }); + setSslCertificates(response.data.certificates || []); } catch (error) { console.error('Failed to fetch SSL certificates:', error);