Allow user to control bound IP addresses
See original GitHub issueIs your feature request related to a problem? Please describe. By default, vite binds to all network interfaces on startup and seems to have no obvious override
Describe the solution you’d like
Ideally the user should have control over the bound network interfaces to reduce the attack surface as appropriate. I initially expected the server to bind to localhost by default and/or to have an optional host
config setting which when set to 0.0.0.0
would bind all network interfaces.
Additional context
As a quick proof of concept I hacked together a fix that allows me to achieve the desired result. I doubt this is appropriate given the switch in default behavior and the confusion it would introduce with host
versus hostname
but it functions as I’d hope and is shared for reference.
https://github.com/vitejs/vite/compare/master...jlewin:master
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (5 by maintainers)
Top GitHub Comments
A little late to reply but this looks to work now as desired, where the listening IP can be controlled by the user and limited to localhost only.
Thanks!
for reference
I think it is unnecessary, your code just control ouput which has host or not in terminal.