fix(config): configure allowedDevOrigins for local network development

This commit is contained in:
2026-11-05 11:30:40 +05:30
parent de40a5582a
commit 378f76df54
+20
View File
@@ -1,6 +1,26 @@
import os from 'os';
function getLocalDevOrigins() {
const origins = ['192.168.1.32', 'localhost', '127.0.0.1'];
try {
const interfaces = os.networkInterfaces();
for (const name of Object.keys(interfaces)) {
for (const iface of interfaces[name] || []) {
if (!iface.internal && iface.family === 'IPv4') {
origins.push(iface.address);
}
}
}
} catch (e) {
// fallback gracefully
}
return Array.from(new Set(origins));
}
/** @type {import('next').NextConfig} */ /** @type {import('next').NextConfig} */
const nextConfig = { const nextConfig = {
reactStrictMode: true, reactStrictMode: true,
allowedDevOrigins: getLocalDevOrigins(),
images: { images: {
unoptimized: true, unoptimized: true,
}, },