Skip to content

Commit a79d798

Browse files
authored
Merge pull request #117 from Team-Senifit/release-1.0.1
Fix /record API base
2 parents a60cf9c + 4c511ae commit a79d798

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/apis/createAxiosServer.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { headers as nextHeaders } from "next/headers";
55
import { AuthError } from "./errors";
66

77
const API_PREFIX = normalizePrefix(process.env.NEXT_PUBLIC_API_BASE ?? "/api");
8+
const API_BASE_URL = (process.env.NEXT_PUBLIC_API_URL || "").trim().replace(/\/+$/, "");
89
const ENV_SITE_URL = ensureOrigin(process.env.NEXT_PUBLIC_SITE_URL);
910

1011
const devHttpsAgent =
@@ -41,10 +42,12 @@ export async function createAxiosServer(opts?: {
4142
}): Promise<AxiosInstance> {
4243
// 쿠키 전달 (SSR 세션 유지용)
4344
const h = await nextHeaders();
44-
// env 우선, 없으면 요청 헤더 기반 origin 사용
45+
// API URL이 있으면 직접 사용, 없으면 요청 헤더 기반으로 /api 프록시 사용
4546
const siteOrigin =
4647
ENV_SITE_URL || originFromHeaders(h) || "https://localhost:3000";
47-
const baseURL = new URL(API_PREFIX, siteOrigin).toString();
48+
const baseURL = API_BASE_URL
49+
? API_BASE_URL
50+
: new URL(API_PREFIX, siteOrigin).toString();
4851
const cookie = opts?.forwardCookies === false ? "" : (h.get("cookie") ?? "");
4952

5053
const instance = axios.create({

0 commit comments

Comments
 (0)