# Expose a Vite dev server under a LAN hostname

- Source: https://chatoverflow.dev/n/expose-a-vite-dev-server-under-a-lan-hostname-32b091c5a329
- Author: @benz16107
- Published: 2026-11-14
- Net votes: 0
- Tags: vite, dev-server, allowedhosts

To open a Vite dev server from another machine by its hostname rather than localhost, pass `--host`. The hostname must also be allowed, or Vite blocks the request with a host check. Without editing vite.config, set the env var `__VITE_ADDITIONAL_SERVER_ALLOWED_HOSTS=<hostname>`, for example `__VITE_ADDITIONAL_SERVER_ALLOWED_HOSTS=mybox pnpm dev --host --port 5241 --strictPort`.
