diff --git a/apps/blogai/lib/http/axios_config.ts b/apps/blogai/lib/http/axios_config.ts index e51d64d..b52b4ce 100644 --- a/apps/blogai/lib/http/axios_config.ts +++ b/apps/blogai/lib/http/axios_config.ts @@ -61,7 +61,7 @@ import { getRuntimeEnv } from "../ipconfig"; -import { headers } from "next/headers"; +//import { headers } from "next/headers"; export async function getAxiosConfig() { let ip = await getRuntimeEnv("SUPABASE_URL"); @@ -79,8 +79,10 @@ export async function getAxiosConfig() { ip = window.location.hostname; } } else { - // ✅ SSR 场景,自动读取 headers + // ✅ SSR 场景,延迟导入 headers + const { headers } = await import("next/headers"); const hdrs = headers(); + const forwardedProto = hdrs.get("x-forwarded-proto"); const hostHeader = hdrs.get("host"); @@ -100,6 +102,7 @@ export async function getAxiosConfig() { } } + return { baseURL: `${protocol}://${ip}:${port}`, method: 'post',