Support *.localhost subdomains

In the new always-on-node service we'll want to test things locally with
domains that look like this: rudolfs.localhost:3080
This commit is contained in:
Rūdolfs Ošiņš
2026-01-13 12:49:18 -06:00
parent 0fae94fce4
commit 8f52b2bdfb
4 changed files with 115 additions and 3 deletions
+1 -1
View File
@@ -243,4 +243,4 @@ export function routeToPath(route: Route): string {
}
}
export const testExports = { urlToRoute, routeToPath };
export const testExports = { urlToRoute, routeToPath, extractBaseUrl };
+2 -2
View File
@@ -203,9 +203,9 @@ export function isMarkdownPath(path: string): boolean {
return /\.(md|mkd|markdown)$/i.test(path);
}
// Check whether the given address is a localhost address.
export function isLocal(addr: string): boolean {
return addr.startsWith("127.0.0.1") || addr.startsWith("localhost");
// Support *.localhost subdomains and 127.0.0.1.
return addr.endsWith("localhost") || addr.startsWith("127.0.0.1");
}
// Check whether the given domain name is an onion domain name.