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() {
|
function loadServiceUrls() {
|
||||||
const stored = localStorage.getItem('service_urls')
|
const stored = localStorage.getItem('service_urls')
|
||||||
const isLocalhost = window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1'
|
// Always use localhost for services - they run on the same machine
|
||||||
const currentOrigin = window.location.origin
|
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) {
|
if (stored) {
|
||||||
try {
|
try {
|
||||||
const urls = JSON.parse(stored)
|
const urls = JSON.parse(stored)
|
||||||
coreApiUrl.value = urls.core || (isLocalhost ? 'http://localhost:3002' : currentOrigin)
|
coreApiUrl.value = urls.core || defaultCore
|
||||||
markbaseUrl.value = urls.markbase || (isLocalhost ? 'http://localhost:11438' : currentOrigin)
|
markbaseUrl.value = urls.markbase || defaultMarkbase
|
||||||
mbeUrl.value = urls.mbe || (isLocalhost ? 'http://localhost:8080' : currentOrigin)
|
mbeUrl.value = urls.mbe || defaultMbe
|
||||||
proxyUrl.value = urls.proxy || (isLocalhost ? 'http://localhost:8888' : currentOrigin)
|
proxyUrl.value = urls.proxy || defaultProxy
|
||||||
workerUrl.value = urls.worker || (isLocalhost ? 'http://localhost:11438' : currentOrigin)
|
workerUrl.value = urls.worker || defaultWorker
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
coreApiUrl.value = isLocalhost ? 'http://localhost:3002' : currentOrigin
|
coreApiUrl.value = defaultCore
|
||||||
markbaseUrl.value = isLocalhost ? 'http://localhost:11438' : currentOrigin
|
markbaseUrl.value = defaultMarkbase
|
||||||
mbeUrl.value = isLocalhost ? 'http://localhost:8080' : currentOrigin
|
mbeUrl.value = defaultMbe
|
||||||
proxyUrl.value = isLocalhost ? 'http://localhost:8888' : currentOrigin
|
proxyUrl.value = defaultProxy
|
||||||
workerUrl.value = isLocalhost ? 'http://localhost:11438' : currentOrigin
|
workerUrl.value = defaultWorker
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
coreApiUrl.value = isLocalhost ? 'http://localhost:3002' : currentOrigin
|
coreApiUrl.value = defaultCore
|
||||||
markbaseUrl.value = isLocalhost ? 'http://localhost:11438' : currentOrigin
|
markbaseUrl.value = defaultMarkbase
|
||||||
mbeUrl.value = isLocalhost ? 'http://localhost:8080' : currentOrigin
|
mbeUrl.value = defaultMbe
|
||||||
proxyUrl.value = isLocalhost ? 'http://localhost:8888' : currentOrigin
|
proxyUrl.value = defaultProxy
|
||||||
workerUrl.value = isLocalhost ? 'http://localhost:11438' : currentOrigin
|
workerUrl.value = defaultWorker
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -852,8 +856,8 @@ async function testCoreApi() {
|
|||||||
testingCore.value = true
|
testingCore.value = true
|
||||||
coreInfo.value = null
|
coreInfo.value = null
|
||||||
try {
|
try {
|
||||||
const isLocalhost = window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1'
|
// Core API directly serves /health on localhost
|
||||||
const healthUrl = isLocalhost ? `${coreApiUrl.value}/health` : `${coreApiUrl.value}/api/v1/health`
|
const healthUrl = `${coreApiUrl.value}/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()
|
||||||
@@ -931,8 +935,7 @@ async function testMbe() {
|
|||||||
async function testProxy() {
|
async function testProxy() {
|
||||||
testingProxy.value = true
|
testingProxy.value = true
|
||||||
try {
|
try {
|
||||||
const isLocalhost = window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1'
|
const healthUrl = `${proxyUrl.value}/health`
|
||||||
const healthUrl = isLocalhost ? `${proxyUrl.value}/health` : `${proxyUrl.value}/api/v1/health`
|
|
||||||
const resp = await fetch(healthUrl, { signal: AbortSignal.timeout(5000) })
|
const resp = await fetch(healthUrl, { signal: AbortSignal.timeout(5000) })
|
||||||
proxyStatus.value = resp.ok ? 'online' : 'offline'
|
proxyStatus.value = resp.ok ? 'online' : 'offline'
|
||||||
} catch {
|
} catch {
|
||||||
|
|||||||
Reference in New Issue
Block a user