add support for railway internal proxy

This commit is contained in:
Matteo Mekhail
2026-02-23 13:10:25 +11:00
parent 0dcb6f71ab
commit 0295041cda

View File

@@ -109,6 +109,11 @@ function isPrivateIp(ip: string): boolean {
if (v4 === "127.0.0.1" || ip === "::1") return true; if (v4 === "127.0.0.1" || ip === "::1") return true;
if (v4.startsWith("10.")) return true; if (v4.startsWith("10.")) return true;
if (v4.startsWith("192.168.")) return true; if (v4.startsWith("192.168.")) return true;
// CGNAT range (RFC 6598) — used by Railway's internal proxy
if (v4.startsWith("100.")) {
const second = parseInt(v4.split(".")[1] ?? "", 10);
if (second >= 64 && second <= 127) return true;
}
if (ip.startsWith("fc") || ip.startsWith("fd")) return true; if (ip.startsWith("fc") || ip.startsWith("fd")) return true;
if (v4.startsWith("172.")) { if (v4.startsWith("172.")) {
const second = parseInt(v4.split(".")[1] ?? "", 10); const second = parseInt(v4.split(".")[1] ?? "", 10);