feat: 重构环境配置与 API 处理逻辑
更新 .env.example,补充玩家端本地开发配置说明,并新增直连 Laravel 服务及局域网访问相关配置选项。 重构 middleware.ts:使用新的 API 请求路径构建方法,提升代码清晰度与可维护性。 移除 next.config.ts 中已弃用的 API_BASE_URL 配置,简化 API 请求处理流程。 调整 lottery-http 以适配新的 API 基础地址解析机制,提升代码维护性。 优化 CSP(内容安全策略)配置,精简连接来源白名单管理,进一步增强安全性。
This commit is contained in:
@@ -3,8 +3,6 @@ import type { NextConfig } from "next";
|
||||
import { nonCspSecurityHeaders } from "./src/lib/csp-config";
|
||||
import { parseAllowedDevOrigins } from "./src/lib/next-dev-origins";
|
||||
|
||||
const lotteryApiProxyTarget =
|
||||
process.env.API_BASE_URL?.trim() || "http://127.0.0.1:8000";
|
||||
const allowedDevOrigins = parseAllowedDevOrigins(process.env.ALLOWED_DEV_ORIGINS);
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
@@ -20,15 +18,6 @@ const nextConfig: NextConfig = {
|
||||
},
|
||||
];
|
||||
},
|
||||
|
||||
async rewrites() {
|
||||
return [
|
||||
{
|
||||
source: "/api/:path*",
|
||||
destination: `${lotteryApiProxyTarget}/api/:path*`,
|
||||
},
|
||||
];
|
||||
},
|
||||
};
|
||||
|
||||
export default nextConfig;
|
||||
|
||||
Reference in New Issue
Block a user