chore: allowedDevOrigins reads ALLOWED_DEV_ORIGINS env (no hardcoded IPs)
Dev-only origin allowlist stays 127.0.0.1 by default; LAN devices can be enabled per-machine via ALLOWED_DEV_ORIGINS=ip1,ip2 without touching the repo.
This commit is contained in:
1 parent
dfe3556987
commit
8e538fea80
1 file changed
+6
-2
+6
-2
@@ -1,7 +1,11 @@
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
// 本地开发同时支持 localhost 和 127.0.0.1,避免客户端脚本被跨源保护拦截。
|
||||
allowedDevOrigins: ['127.0.0.1'],
|
||||
// 本地开发允许的来源:默认本机;局域网/其他设备通过环境变量追加
|
||||
// ALLOWED_DEV_ORIGINS=192.168.x.x,10.0.0.x (仅开发用,不写死具体 IP)
|
||||
allowedDevOrigins: [
|
||||
'127.0.0.1',
|
||||
...(process.env.ALLOWED_DEV_ORIGINS ? process.env.ALLOWED_DEV_ORIGINS.split(',').map((s) => s.trim()) : []),
|
||||
],
|
||||
// Docker 部署用 standalone 输出;serverless(Vercel/CF Pages)不需要
|
||||
...(process.env.DOCKER ? { output: 'standalone' } : {}),
|
||||
// /uploads/* 由 API 路由提供(上传文件运行时新增,不进 public 构建快照)
|
||||
|
||||
Reference in new issue
Block a user