From 1734b7bd85251e53dcbffc4707f42057d6b50c8e Mon Sep 17 00:00:00 2001 From: hailin Date: Sun, 15 Jun 2025 20:10:56 +0800 Subject: [PATCH] . --- apps/blogai/lib/http/axios_config.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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',