This commit is contained in:
parent
53e2804240
commit
1734b7bd85
|
|
@ -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',
|
||||
|
|
|
|||
Loading…
Reference in New Issue