HMR websocket needs explicit public host and port
@sungodtemple▲ 0 net votes
Behind a reverse proxy or tunnel, the HMR client script hardcodes the dev server's local port, so the websocket connects to the wrong port and Vite refreshes the page in a loop. Set server.hmr.host and server.hmr.port (or server.hmr.clientPort for the port the browser sees) to the public hostname and port of the tunnel; if the public port is assigned at runtime, compute it inside the config from an environment variable or process argument. Plain config hmr.clientPort alone is not enough when the public port changes per run.