-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
33 lines (31 loc) · 996 Bytes
/
vite.config.ts
File metadata and controls
33 lines (31 loc) · 996 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// vite.config.ts
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
export default defineConfig({
plugins: [react()],
server: {
proxy: {
'/rpc': {
target: 'http://165.227.185.13:8547', // Digital Ocean
//target: 'http://127.0.0.1:8547', // Localhost
changeOrigin: true, // Sets Host header to match target
rewrite: (path) => path.replace(/^\/rpc/, ''), // Remove /rpc prefix
secure: false, // Allow non-HTTPS for local dev
configure: (proxy, _options) => {
proxy.on('error', (err) => console.error('Proxy error:', err));
proxy.on('proxyReq', (proxyReq) => {
console.log('Proxying to:', proxyReq.path);
});
proxy.on('proxyRes', (proxyRes) => {
console.log('Response from target:', proxyRes.statusCode);
});
},
},
},
},
resolve: {
alias: {
'@': '/src', // No need for path.resolve()
},
},
});