This commit is contained in:
hailin 2025-06-15 20:10:56 +08:00
parent 53e2804240
commit 1734b7bd85
1 changed files with 5 additions and 2 deletions

View File

@ -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',