Fix: Backend Server SSL certificate dropdown not loading

🐛 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
This commit is contained in:
taylanbakircioglu
2025-11-07 11:51:14 +03:00
parent 86298b911f
commit 457fd28bb3
+14 -2
View File
@@ -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);