diff --git a/src/app/api/gateways/health/health-utils.test.ts b/src/app/api/gateways/health/health-utils.test.ts index c1e330a..d7d079e 100644 --- a/src/app/api/gateways/health/health-utils.test.ts +++ b/src/app/api/gateways/health/health-utils.test.ts @@ -80,7 +80,7 @@ function buildGatewayProbeUrl(host: string, port: number): string | null { if (!parsed.port && Number.isFinite(port) && port > 0) { parsed.port = String(port) } - if (!parsed.pathname) parsed.pathname = '/' + parsed.pathname = parsed.pathname.replace(/\/+$/, '') + '/api/health' return parsed.toString() } catch { return null @@ -88,7 +88,7 @@ function buildGatewayProbeUrl(host: string, port: number): string | null { } if (!Number.isFinite(port) || port <= 0) return null - return `http://${rawHost}:${port}/` + return `http://${rawHost}:${port}/api/health` } function parseGatewayVersion(headers: Record): string | null { @@ -180,7 +180,7 @@ describe('isBlockedUrl', () => { describe('buildGatewayProbeUrl', () => { it('builds URL from bare host + port', () => { - expect(buildGatewayProbeUrl('example.com', 8080)).toBe('http://example.com:8080/') + expect(buildGatewayProbeUrl('example.com', 8080)).toBe('http://example.com:8080/api/health') }) it('preserves https:// protocol', () => { diff --git a/src/app/api/gateways/health/route.ts b/src/app/api/gateways/health/route.ts index 3f58d33..381637d 100644 --- a/src/app/api/gateways/health/route.ts +++ b/src/app/api/gateways/health/route.ts @@ -144,7 +144,7 @@ function buildGatewayProbeUrl(host: string, port: number): string | null { if (!parsed.port && Number.isFinite(port) && port > 0) { parsed.port = String(port) } - if (!parsed.pathname) parsed.pathname = '/' + parsed.pathname = parsed.pathname.replace(/\/+$/, '') + '/api/health' return parsed.toString() } catch { return null @@ -152,7 +152,7 @@ function buildGatewayProbeUrl(host: string, port: number): string | null { } if (!Number.isFinite(port) || port <= 0) return null - return `http://${rawHost}:${port}/` + return `http://${rawHost}:${port}/api/health` } /**