初始化提交
This commit is contained in:
commit
887c1f449e
963 files changed
+166869
No files matched your search
@@ -0,0 +1,31 @@
|
||||
import type { NextConfig } from "next";
|
||||
|
||||
/** 玄关网关地址(Go MCP 网关,默认 8080)。 */
|
||||
const GATEWAY_URL =
|
||||
process.env.GATEWAY_URL ??
|
||||
process.env.NEXT_PUBLIC_GATEWAY_URL ??
|
||||
"http://localhost:8080";
|
||||
|
||||
module.exports = {
|
||||
allowedDevOrigins: ["192.168.1.5"],
|
||||
};
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
/**
|
||||
* 仅 /api/gateway/* 代理到 Go 玄关网关(MCP)。
|
||||
*
|
||||
* 业务 REST / SSE / 认证请求统一经 BFF 路由(/api/proxy、/api/sse、/api/auth),
|
||||
* 在服务端从 httpOnly cookie 读取 token 并注入 Authorization,不再经 rewrites。
|
||||
* 后端绝对地址由 BFF route 通过 lib/config 的 API_BASE_URL 解析。
|
||||
*/
|
||||
async rewrites() {
|
||||
return [
|
||||
{
|
||||
source: "/api/gateway/:path*",
|
||||
destination: `${GATEWAY_URL}/:path*`,
|
||||
},
|
||||
];
|
||||
},
|
||||
};
|
||||
|
||||
export default nextConfig;
|
||||
Reference in new issue
Block a user