1/**
2 * Hostnames that mean "this machine" in a connection string. Inside a Docker
3 * container they resolve to the container itself, so alchemy rewrites them to
4 * `host.docker.localhost` (Prisma's `prisma+postgres://` plain-HTTP gate
5 * requires a localhost-looking host).
6 *
7 * Native Linux Docker cannot SYN Docker's `host-gateway` (bridge IP) without
8 * hitting host INPUT / UFW. Binding extra host IPs does not skip that.
9 * The workerd sidecar proxy instead unix-socket-tunnels these ports into
10 * the container netns — see `DockerLoopback.ts` in cloudflare-runtime.
11 */
12export const isLoopbackHost = (hostname: string) =>
13 hostname === "localhost" ||
14 hostname === "127.0.0.1" ||
15 hostname === "0.0.0.0" ||
16 hostname === "::1" ||
17 hostname === "[::1]" ||
18 hostname.endsWith(".localhost");