api proxy working :)

This commit is contained in:
= 2024-12-06 03:25:50 +01:00
parent e53fc84ac3
commit bf73ed1698
2 changed files with 19 additions and 4 deletions

View file

@ -7,10 +7,25 @@ export default defineConfig({
server: {
proxy: {
'/api': {
target: 'http://localhost:2486',
target: 'http://127.0.0.1:2486',
changeOrigin: true,
rewrite: path => path.replace(/^\/api/, '')
secure: false,
ws: true,
/*
configure: (proxy, _options) => {
proxy.on('error', (err, _req, _res) => {
console.log('proxy error', err);
});
proxy.on('proxyReq', (proxyReq, req, _res) => {
console.log('Sending Request to the Target:', req.method, req.url);
});
proxy.on('proxyRes', (proxyRes, req, _res) => {
console.log('Received Response from the Target:', proxyRes.statusCode, req.url);
});
},
*/
//rewrite: path => path.replace(/^\/api/, '')
}
}
}
},
})