Add troubleshooting section for Cloudflare HTTPS and mixed content issues; update services-loader.js to support local IP for health checks

This commit is contained in:
MayaChat
2025-11-24 12:32:38 -05:00
parent af2658bfce
commit 423557fe5c
2 changed files with 25 additions and 3 deletions

View File

@@ -85,7 +85,8 @@
const proto = s.getAttribute('proto') || 'http';
const port = s.getAttribute('port') || '';
const logo = s.getAttribute('logo') || '';
const hostAttr = s.getAttribute('host'); // optional public hostname or full URL
const hostAttr = s.getAttribute('host'); // optional public hostname or full URL
const localIpAttr = s.getAttribute('local-ip'); // optional local IP for proxied health-check
const manualStatus = s.getAttribute('status'); // optional: 'online', 'offline', 'maintenance'
const checkHealth = s.getAttribute('check-health') !== 'false'; // default true, set to false to disable
@@ -126,7 +127,7 @@
healthCheckUrl = `/healthcheck?host=${encodedHost}&port=${encodeURIComponent(hcPort)}&proto=${encodeURIComponent(parsedProto)}`;
} else {
// Local service - use Tailscale IP if configured, otherwise current hostname
const targetHost = tailscaleIP || host;
const targetHost = localIpAttr || tailscaleIP || host;
let portPart = '';
if(port && !((proto==='http'&&port==='80')||(proto==='https'&&port==='443'))){ portPart = ':'+port; }
// Keep the link protocol as the defined proto (so clicking uses the intended protocol),
@@ -134,7 +135,12 @@
href = `${proto}://${targetHost}${portPart}`;
// Use our same-origin proxy path which nginx will forward to the health-proxy service.
const encodedHost = encodeURIComponent(targetHost);
const hcPort = port || (desiredProto === 'https' ? '443' : '80');
const hcPort = port || (desiredProto === 'https' ? '443' : '80');
if(localIpAttr){
console.log(`Service ${name}: using local-ip ${localIpAttr} for proxied health checks`);
} else if(tailscaleIP){
console.log(`Service ${name}: using tailscale-ip ${tailscaleIP} for proxied health checks`);
}
healthCheckUrl = `/healthcheck?host=${encodedHost}&port=${encodeURIComponent(hcPort)}&proto=${encodeURIComponent(desiredProto)}`;
// Warn when site is secure but service link is HTTP and target is a private IP
if(pageIsSecure && proto === 'http' && targetHost === tailscaleIP){