Skip to content

Commit 6cb43fc

Browse files
committed
fix: add rewrite rule for /api proxy in dev server
1 parent 8a543c9 commit 6cb43fc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

vite.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ export default ({ mode }: ConfigEnv): UserConfig => {
1818
port: 3000,
1919
proxy: {
2020
'/api': {
21-
target: '',
21+
target: '', // Your backend API base URL
2222
ws: false,
2323
changeOrigin: true,
24+
rewrite: path => path.replace(/^\/api/, ''),
2425
},
2526
},
2627
},

0 commit comments

Comments
 (0)