const FALLBACK_API_ORIGIN = 'http://localhost:5179' export const API_ORIGIN = (import.meta.env.VITE_API_ORIGIN || FALLBACK_API_ORIGIN).replace(/\/+$/, '') export function toApiUrl(path = '') { const p = path.startsWith('/') ? path : `/${path}` // 운영(Nginx 프록시)에서는 같은 도메인/프로토콜로 호출해야 // 세션 쿠키(`Set-Cookie`)가 브라우저에 정상 저장됩니다. if (import.meta.env.PROD) return p if (/^https?:\/\//.test(path)) return path return `${API_ORIGIN}${p}` }