fix: Admin panel always uses localhost URLs for service health checks
- Removed isLocalhost checks from loadServiceUrls() - All services now default to http://localhost:XXXX - Health check URLs always use direct paths (/health) - Fixes Core API and Proxy showing offline from external URL
This commit is contained in:
@@ -799,30 +799,34 @@ function serviceState(name: string) {
|
||||
|
||||
function loadServiceUrls() {
|
||||
const stored = localStorage.getItem('service_urls')
|
||||
const isLocalhost = window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1'
|
||||
const currentOrigin = window.location.origin
|
||||
// Always use localhost for services - they run on the same machine
|
||||
const defaultCore = 'http://localhost:3002'
|
||||
const defaultMarkbase = 'http://localhost:11438'
|
||||
const defaultMbe = 'http://localhost:8080'
|
||||
const defaultProxy = 'http://localhost:8888'
|
||||
const defaultWorker = 'http://localhost:11438'
|
||||
|
||||
if (stored) {
|
||||
try {
|
||||
const urls = JSON.parse(stored)
|
||||
coreApiUrl.value = urls.core || (isLocalhost ? 'http://localhost:3002' : currentOrigin)
|
||||
markbaseUrl.value = urls.markbase || (isLocalhost ? 'http://localhost:11438' : currentOrigin)
|
||||
mbeUrl.value = urls.mbe || (isLocalhost ? 'http://localhost:8080' : currentOrigin)
|
||||
proxyUrl.value = urls.proxy || (isLocalhost ? 'http://localhost:8888' : currentOrigin)
|
||||
workerUrl.value = urls.worker || (isLocalhost ? 'http://localhost:11438' : currentOrigin)
|
||||
coreApiUrl.value = urls.core || defaultCore
|
||||
markbaseUrl.value = urls.markbase || defaultMarkbase
|
||||
mbeUrl.value = urls.mbe || defaultMbe
|
||||
proxyUrl.value = urls.proxy || defaultProxy
|
||||
workerUrl.value = urls.worker || defaultWorker
|
||||
} catch (e) {
|
||||
coreApiUrl.value = isLocalhost ? 'http://localhost:3002' : currentOrigin
|
||||
markbaseUrl.value = isLocalhost ? 'http://localhost:11438' : currentOrigin
|
||||
mbeUrl.value = isLocalhost ? 'http://localhost:8080' : currentOrigin
|
||||
proxyUrl.value = isLocalhost ? 'http://localhost:8888' : currentOrigin
|
||||
workerUrl.value = isLocalhost ? 'http://localhost:11438' : currentOrigin
|
||||
coreApiUrl.value = defaultCore
|
||||
markbaseUrl.value = defaultMarkbase
|
||||
mbeUrl.value = defaultMbe
|
||||
proxyUrl.value = defaultProxy
|
||||
workerUrl.value = defaultWorker
|
||||
}
|
||||
} else {
|
||||
coreApiUrl.value = isLocalhost ? 'http://localhost:3002' : currentOrigin
|
||||
markbaseUrl.value = isLocalhost ? 'http://localhost:11438' : currentOrigin
|
||||
mbeUrl.value = isLocalhost ? 'http://localhost:8080' : currentOrigin
|
||||
proxyUrl.value = isLocalhost ? 'http://localhost:8888' : currentOrigin
|
||||
workerUrl.value = isLocalhost ? 'http://localhost:11438' : currentOrigin
|
||||
coreApiUrl.value = defaultCore
|
||||
markbaseUrl.value = defaultMarkbase
|
||||
mbeUrl.value = defaultMbe
|
||||
proxyUrl.value = defaultProxy
|
||||
workerUrl.value = defaultWorker
|
||||
}
|
||||
}
|
||||
|
||||
@@ -852,8 +856,8 @@ async function testCoreApi() {
|
||||
testingCore.value = true
|
||||
coreInfo.value = null
|
||||
try {
|
||||
const isLocalhost = window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1'
|
||||
const healthUrl = isLocalhost ? `${coreApiUrl.value}/health` : `${coreApiUrl.value}/api/v1/health`
|
||||
// Core API directly serves /health on localhost
|
||||
const healthUrl = `${coreApiUrl.value}/health`
|
||||
const resp = await fetch(healthUrl, { signal: AbortSignal.timeout(5000) })
|
||||
if (!resp.ok) throw new Error(`HTTP ${resp.status}`)
|
||||
const data = await resp.json()
|
||||
@@ -931,8 +935,7 @@ async function testMbe() {
|
||||
async function testProxy() {
|
||||
testingProxy.value = true
|
||||
try {
|
||||
const isLocalhost = window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1'
|
||||
const healthUrl = isLocalhost ? `${proxyUrl.value}/health` : `${proxyUrl.value}/api/v1/health`
|
||||
const healthUrl = `${proxyUrl.value}/health`
|
||||
const resp = await fetch(healthUrl, { signal: AbortSignal.timeout(5000) })
|
||||
proxyStatus.value = resp.ok ? 'online' : 'offline'
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user