MCPcopy Create free account
hub / github.com/ForestHubAI/edge-agents / isLoopbackHost

Function isLoopbackHost

ts/workflow-cli/server/fileBridge.ts:34–38  ·  view source on GitHub ↗

True if a Host header or URL hostname is a loopback name ("localhost", "127.0.0.1", "[::1]"), with or without port.

(host: string | undefined)

Source from the content-addressed store, hash-verified

32
33/** True if a Host header or URL hostname is a loopback name ("localhost", "127.0.0.1", "[::1]"), with or without port. */
34function isLoopbackHost(host: string | undefined): boolean {
35 if (!host) return false;
36 const name = host.startsWith("[") ? host.slice(0, host.indexOf("]") + 1) : host.replace(/:\d+$/, "");
37 return name === "localhost" || name === "127.0.0.1" || name === "[::1]";
38}
39
40/**
41 * True if the request is plainly same-machine browser traffic (or a

Callers 1

isTrustedRequestFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected