fix: auto-detect all LAN IPs for dev auth and HMR

No more manual LAN_HOST or BETTER_AUTH_TRUSTED_ORIGINS for dev.
Uses os.networkInterfaces() to allow all machine IPs automatically.
This commit is contained in:
2026-03-24 03:35:02 +03:00
parent 4cae7b48ef
commit 0e53fba726
3 changed files with 22 additions and 21 deletions

View File

@@ -1,9 +1,16 @@
import type { NextConfig } from "next";
import os from "os";
// Автоопределение LAN IP для dev — убирает "Blocked cross-origin" без ручной настройки
const lanIPs = Object.values(os.networkInterfaces())
.flat()
.filter((iface) => iface && !iface.internal && iface.family === "IPv4")
.map((iface) => iface!.address);
const nextConfig: NextConfig = {
output: "standalone",
serverExternalPackages: ["@prisma/client", "bcryptjs", "ioredis"],
allowedDevOrigins: ["192.168.1.78"],
allowedDevOrigins: lanIPs,
};
export default nextConfig;