You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We use vite dev server locally and behind proxy, for example, we start vite at localhost:8080, we want to access it via http://localhost:8080 or we use local proxy (caddy, nginx, whistle...) to access via some domain(like http://local.dev.app).
But currently, vite's hmr options is not working for our scenario. Vite can only configure hmr's websocket port to one specific port, which means we can't let it connect in ws://localhost:8080 when access via http://localhost:8080 and connect in ws://local.dev.app via http://local.dev.app.
I use a similar setup (caddy proxy) to try and make the development environment as similar to production as possible (w.r.t https, CORS, subdomains, etc).
This would be a very useful feature.
Clear and concise description of the problem
We use vite dev server locally and behind proxy, for example, we start vite at localhost:8080, we want to access it via http://localhost:8080 or we use local proxy (caddy, nginx, whistle...) to access via some domain(like http://local.dev.app).
But currently, vite's hmr options is not working for our scenario. Vite can only configure hmr's websocket port to one specific port, which means we can't let it connect in ws://localhost:8080 when access via http://localhost:8080 and connect in ws://local.dev.app via http://local.dev.app.
And we cannot find any way to edit it dynamicly.
The code is https://github.com/vitejs/vite/blob/v2.6.9/packages/vite/src/node/plugins/clientInjections.ts#L26-L34
Suggested solution
We can add an option to enforce hmr connection use location.port, like
server.hmr.useLocationPort
.Alternative
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: