fix: Core API health check path - use /api/v1/health for all cases

- Removed incorrect localhost conditional that used /health (404)
- Now uses /api/v1/health for both localhost and remote access
- Added console.error logging for debugging
- Aligns with Core API route design
This commit is contained in:
2026-10-27 15:52:30 +08:00
parent a5100e59ea
commit e15d2cd31e

View File

@@ -935,16 +935,15 @@ async function testCoreApi() {
testingCore.value = true testingCore.value = true
coreInfo.value = null coreInfo.value = null
try { try {
const isLocalhost = coreApiUrl.value.includes('localhost') || coreApiUrl.value.includes('127.0.0.1') // Core API uses /api/v1/health for both localhost and remote access
// Localhost: direct /health path const healthUrl = `${coreApiUrl.value}/api/v1/health`
// Remote: via reverse proxy at /api/v1/health
const healthUrl = isLocalhost ? `${coreApiUrl.value}/health` : `${coreApiUrl.value}/api/v1/health`
const resp = await fetch(healthUrl, { signal: AbortSignal.timeout(5000) }) const resp = await fetch(healthUrl, { signal: AbortSignal.timeout(5000) })
if (!resp.ok) throw new Error(`HTTP ${resp.status}`) if (!resp.ok) throw new Error(`HTTP ${resp.status}`)
const data = await resp.json() const data = await resp.json()
coreStatus.value = 'online' coreStatus.value = 'online'
coreInfo.value = { version: data.version, uptime: data.uptime_ms } coreInfo.value = { version: data.version, uptime: data.uptime_ms }
} catch (e: any) { } catch (e: any) {
console.error('[testCoreApi] Failed:', e.message || e)
coreStatus.value = 'offline' coreStatus.value = 'offline'
coreInfo.value = null coreInfo.value = null
} finally { } finally {