I have a client( on port 5173) and a server( on port 8080). I have been trying to make a request with fetch to the server through vite proxy. But it keep making request to the client server with port 5173. My proxy config is like this
server: {
proxy: {
'/api': {
target: 'http://localhost:8080',
changeOrigin: true,
secure: false,
ws:true,
rewrite: (path) => path.replace(/^/api/, '')
}
}
}
and I make a request like this:
const request=await fetch('/api/login/')