Force internal server proxy to loopback (#521)

This commit is contained in:
shenlan 2025-10-14 20:06:22 +08:00 committed by GitHub
parent 72e8da1dd4
commit 2b4760adfa

View File

@ -217,7 +217,15 @@ export function getInternalServerServiceBaseUrl(): string {
try {
const parsed = new URL(external)
if (LOCAL_HOSTNAMES.has(parsed.hostname)) {
return normalizeBaseUrl(external)
if (parsed.hostname !== '127.0.0.1') {
parsed.hostname = '127.0.0.1'
}
if (parsed.protocol === 'https:') {
parsed.protocol = 'http:'
}
return normalizeBaseUrl(parsed.toString())
}
} catch {
// Ignore parsing errors and fall back to the internal default below.