fix(atlas): skip http:// health checks from https context (mixed content warning)
Vercel-hosted Atlas (HTTPS) was attempting HEAD requests to http:// internal endpoints (Gitea, Syncthing), causing browsers to show insecure connection warning. Now skips those requests silently; status stays at last known value. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
dc602f7ea7
commit
0b9902b495
11
index.html
11
index.html
|
|
@ -2009,7 +2009,10 @@ async function runHealthCheckAll() {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const result = await checkUrlHealth(node.url);
|
const result = await checkUrlHealth(node.url);
|
||||||
|
// 'skipped' = HTTP endpoint from HTTPS context — leave status unchanged
|
||||||
|
if (result !== 'skipped') {
|
||||||
next = result === 'offline' ? 'inactive' : 'active';
|
next = result === 'offline' ? 'inactive' : 'active';
|
||||||
|
}
|
||||||
nodeHealthCache.delete(node.id);
|
nodeHealthCache.delete(node.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2036,6 +2039,9 @@ async function runHealthCheckAll() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function checkUrlHealth(url) {
|
async function checkUrlHealth(url) {
|
||||||
|
// HTTPS ページから HTTP エンドポイントへのリクエストは混合コンテンツとしてブロックされる
|
||||||
|
// → ブラウザが「保護されていない通信」警告を出すため、スキップして 'skipped' を返す
|
||||||
|
if (location.protocol === 'https:' && url.startsWith('http:')) return 'skipped';
|
||||||
try {
|
try {
|
||||||
const ctrl = new AbortController();
|
const ctrl = new AbortController();
|
||||||
const timer = setTimeout(() => ctrl.abort(), 7000);
|
const timer = setTimeout(() => ctrl.abort(), 7000);
|
||||||
|
|
@ -2518,6 +2524,10 @@ async function checkNodeHealth(nodeId, url) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// /api/health なし → 従来の HEAD リクエスト
|
// /api/health なし → 従来の HEAD リクエスト
|
||||||
|
// HTTP endpoint from HTTPS context はブロックされるのでスキップ
|
||||||
|
if (location.protocol === 'https:' && url && url.startsWith('http:')) {
|
||||||
|
result = 'limited';
|
||||||
|
} else {
|
||||||
try {
|
try {
|
||||||
const ctrl = new AbortController();
|
const ctrl = new AbortController();
|
||||||
const timer = setTimeout(() => ctrl.abort(), 6000);
|
const timer = setTimeout(() => ctrl.abort(), 6000);
|
||||||
|
|
@ -2528,6 +2538,7 @@ async function checkNodeHealth(nodeId, url) {
|
||||||
result = 'offline';
|
result = 'offline';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const labelMap = { online: 'online', limited: '到達可能', offline: '到達不可' };
|
const labelMap = { online: 'online', limited: '到達可能', offline: '到達不可' };
|
||||||
dot.className = `health-dot ${result}`;
|
dot.className = `health-dot ${result}`;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue