Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

712 B
Raw Blame
export type TrustProxyMode = "none" | "loopback" | "private";

/**
 * How far a reverse proxy in front of OmniRoute is trusted to report the client, from
 * `OMNIROUTE_TRUST_PROXY`: unset or falsy trusts none, `true` / `loopback` a proxy on the
 * loopback interface, `private` / `lan` also a proxy on a private-LAN address.
 */
export function getTrustProxyMode(): TrustProxyMode {
  const raw = process.env.OMNIROUTE_TRUST_PROXY?.trim().toLowerCase();
  if (!raw || ["0", "false", "none", "off", "no", "disable", "disabled"].includes(raw)) {
    return "none";
  }
  if (["true", "1", "loopback"].includes(raw)) return "loopback";
  if (raw === "private" || raw === "lan") return "private";
  return "none";
}