Files
lotteryFront/next.config.ts
kang 55bd56116d feat: 重构环境配置与 API 处理逻辑
更新 .env.example,补充玩家端本地开发配置说明,并新增直连 Laravel 服务及局域网访问相关配置选项。
重构 middleware.ts:使用新的 API 请求路径构建方法,提升代码清晰度与可维护性。
移除 next.config.ts 中已弃用的 API_BASE_URL 配置,简化 API 请求处理流程。
调整 lottery-http 以适配新的 API 基础地址解析机制,提升代码维护性。
优化 CSP(内容安全策略)配置,精简连接来源白名单管理,进一步增强安全性。
2026-05-29 11:48:33 +08:00

24 lines
630 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import type { NextConfig } from "next";
import { nonCspSecurityHeaders } from "./src/lib/csp-config";
import { parseAllowedDevOrigins } from "./src/lib/next-dev-origins";
const allowedDevOrigins = parseAllowedDevOrigins(process.env.ALLOWED_DEV_ORIGINS);
const nextConfig: NextConfig = {
...(allowedDevOrigins.length > 0 ? { allowedDevOrigins } : {}),
reactCompiler: true,
// 非 CSP 安全头CSP 由 middleware 按后台接入站点白名单动态生成。
async headers() {
return [
{
source: "/:path*",
headers: nonCspSecurityHeaders,
},
];
},
};
export default nextConfig;