Skip to content

Commit 0fe6e4e

Browse files
authored
Merge pull request #103 from WithTime12/bugfix/#102
[Bugfix] 프록시 설정
2 parents e29d228 + 10326fb commit 0fe6e4e

File tree

2 files changed

+24
-12
lines changed

2 files changed

+24
-12
lines changed

src/api/axiosInstance.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ interface IRefreshResponse {
99
message: string;
1010
}
1111
export const axiosInstance = axios.create({
12-
baseURL: import.meta.env.VITE_API_BASE_URL,
12+
baseURL: '/api',
1313
withCredentials: true,
1414
});
1515

vite.config.ts

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,29 @@
11
import tailwindcss from '@tailwindcss/vite';
22
import react from '@vitejs/plugin-react-swc';
3-
import { defineConfig } from 'vite';
3+
import { defineConfig, loadEnv } from 'vite';
44
import svgr from 'vite-plugin-svgr';
55

6-
export default defineConfig({
7-
plugins: [react(), svgr({ include: '**/*.svg?react' }), tailwindcss()],
8-
server: {
9-
host: '0.0.0.0',
10-
port: 5173,
11-
},
12-
resolve: {
13-
alias: {
14-
'@': '/src',
6+
export default defineConfig(({ mode }) => {
7+
const env = loadEnv(mode, process.cwd(), '');
8+
const target = env.VITE_API_BASE_URL;
9+
return {
10+
plugins: [react(), svgr({ include: '**/*.svg?react' }), tailwindcss()],
11+
server: {
12+
host: '0.0.0.0',
13+
port: 5173,
14+
proxy: {
15+
'/api': {
16+
target,
17+
changeOrigin: true,
18+
secure: true,
19+
rewrite: (path) => path.replace(/^\/api/, ''),
20+
},
21+
},
1522
},
16-
},
23+
resolve: {
24+
alias: {
25+
'@': '/src',
26+
},
27+
},
28+
};
1729
});

0 commit comments

Comments
 (0)