From 605e556170b5cf9cca301e4730ba153668e38881 Mon Sep 17 00:00:00 2001 From: sunglitter Date: Thu, 5 Dec 2024 23:59:25 +0900 Subject: [PATCH] =?UTF-8?q?Feat:=20=ED=94=84=EB=A1=A0=ED=8A=B8=20=EB=A1=9C?= =?UTF-8?q?=EC=BB=AC=20=ED=99=98=EA=B2=BD=EC=97=90=EC=84=9C=20=EB=B0=B1?= =?UTF-8?q?=EC=97=94=EB=93=9C=20=EC=84=9C=EB=B2=84=20=EC=97=B0=EB=8F=99=20?= =?UTF-8?q?=EC=9E=91=EC=97=85=20(#27)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 백엔드 API 엔드포인트와 프론트엔드 환경 연동 설정 --- src/api/axiosInstance.ts | 2 +- vite.config.mts | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/api/axiosInstance.ts b/src/api/axiosInstance.ts index 0310cf0..0e43624 100644 --- a/src/api/axiosInstance.ts +++ b/src/api/axiosInstance.ts @@ -1,7 +1,7 @@ import axios from 'axios'; const axiosInstance = axios.create({ - baseURL: import.meta.env.VITE_API_URL, // API URL + baseURL: 'http://15.164.5.135:8080', // API URL timeout: 5000, // 요청 제한 시간 (ms) headers: { 'Content-Type': 'application/json', // JSON 형식 사용 diff --git a/vite.config.mts b/vite.config.mts index 06431c2..e235061 100644 --- a/vite.config.mts +++ b/vite.config.mts @@ -10,5 +10,14 @@ export default defineConfig(({ mode }) => { define: { 'process.env': env, }, + server: { + proxy: { + '/api': { + target: 'http://15.164.5.135:8080', // 백엔드 주소 + changeOrigin: true, // CORS 우회 + rewrite: (path) => path.replace(/^\/api/, '/api'), // 이 부분은 경로를 그대로 두어야 함 + }, + }, + }, }; });