let vite be the proxy to the dev server (#1630)

This commit is contained in:
Alex Christoffer Rasmussen
2025-06-09 12:34:18 +02:00
committed by Carlos Valente
parent 62c8319d70
commit c41fe824cf
2 changed files with 30 additions and 4 deletions
+29
View File
@@ -39,6 +39,29 @@ export default defineConfig({
],
server: {
port: 3000,
proxy: {
'^/login*': {
target: 'http://localhost:4001/',
changeOrigin: true,
configure: logProxyRequests,
},
'^/data*': {
target: 'http://localhost:4001/',
changeOrigin: true,
configure: logProxyRequests,
},
'^/api*': {
target: 'http://localhost:4001/',
changeOrigin: true,
configure: logProxyRequests,
},
'^/ws*': {
target: 'http://localhost:4001/',
changeOrigin: true,
configure: logProxyRequests,
ws: true,
},
},
},
test: {
globals: true,
@@ -78,3 +101,9 @@ export default defineConfig({
},
},
});
function logProxyRequests(proxy) {
proxy.on('proxyReq', (_proxyReq, req, _res) => {
console.log('Proxy:', req.method, req.url);
});
}