Fix HAProxy 2.6 compatibility for default backend
All checks were successful
HAProxy Manager Build and Push / Build-and-Push (push) Successful in 37s

- Replace http-response set-body (HAProxy 2.8+) with local server approach
- Add separate Flask server on port 8080 to serve default page
- Update default backend template to use local server instead of inline HTML
- Maintain all customization features via environment variables
- Fix JavaScript error handling for domains API response
This commit is contained in:
2025-07-11 19:27:42 -07:00
parent 27f3f8959b
commit fac6cef0db
4 changed files with 63 additions and 19 deletions

View File

@@ -7,6 +7,5 @@ backend default-backend
http-request set-header X-Forwarded-For %[src]
http-request set-header X-Real-IP %[src]
# Serve the default page HTML response
http-response set-header Content-Type text/html
http-response set-body "{{ default_page_content }}"
# Serve the default page HTML response using a local server
server default-page 127.0.0.1:8080

View File

@@ -346,16 +346,34 @@
function loadDomains() {
fetch('/api/domains')
.then(response => response.json())
.then(response => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
}
return response.json();
})
.then(domains => {
const domainList = document.getElementById('domainList');
domainList.innerHTML = '';
// Ensure domains is an array
if (!Array.isArray(domains)) {
console.error('Expected array of domains, got:', typeof domains, domains);
showStatus('Error: Invalid response format from server', 'error');
return;
}
if (domains.length === 0) {
domainList.innerHTML = '<div class="domain-list-item"><p>No domains configured yet. Add your first domain above.</p></div>';
return;
}
domains.forEach(domain => {
const domainDiv = document.createElement('div');
domainDiv.className = 'domain-list-item';
domainDiv.innerHTML = `
<h3>${domain.domain}</h3>
<p>Backend: ${domain.backend_name}</p>
<p>Backend: ${domain.backend_name || 'Not configured'}</p>
<p>SSL: ${domain.ssl_enabled ? 'Enabled' : 'Disabled'}</p>
<button onclick="requestSSL('${domain.domain}')" class="ssl-btn">
${domain.ssl_enabled ? 'Renew SSL' : 'Enable SSL'}