릴리스: v0.1.37 운영 배포 설정과 로컬 변경 동기화
This commit is contained in:
@@ -3,7 +3,12 @@ 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 = '') {
|
||||
if (!path) return API_ORIGIN
|
||||
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}${path.startsWith('/') ? path : `/${path}`}`
|
||||
return `${API_ORIGIN}${p}`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user