fix(config): configure allowedDevOrigins for local network development
This commit is contained in:
@@ -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} */
|
||||
const nextConfig = {
|
||||
reactStrictMode: true,
|
||||
allowedDevOrigins: getLocalDevOrigins(),
|
||||
images: {
|
||||
unoptimized: true,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user