The internet is full of stories about the troubles of running Vite-enabled projects through a SSH tunnel.
When Vite’s dev server runs locally but is accessed remotely through an SSH reverse tunnel → nginx → TLS → browser, idle HMR WebSocket pings can get delayed or suppressed enough that the client times out and force reloads the entire page.
TL;DR: Set server.hmr.timeout: 10000 (= 10 sec ping interval) in your Vite config.
I got finally it to work - this is my setup for a VueJS project.