Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(server): Listen only to 127.0.0.1 by default #2977

Merged
merged 12 commits into from
May 5, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(server): Adjust CLI output regarding which IPs the server listens to
  • Loading branch information
eirslett committed May 2, 2021
commit 1377b03958811e3f93961a7e7e60b730bffb3d53
6 changes: 2 additions & 4 deletions packages/vite/src/node/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,8 @@ export async function preview(
)
if (hostname === '127.0.0.1') {
const url = `${protocol}://localhost:${chalk.bold(port)}${base}`
logger.info(` > ${chalk.cyan(url)}`)
logger.info(
` (run Vite with paramater --host 0.0.0.0 to listen to all network interfaces)`
)
logger.info(` > Local: ${chalk.cyan(url)}`)
logger.info(` > Network: ${chalk.dim('use `--host` to expose')}`)
} else {
const interfaces = os.networkInterfaces()
Object.keys(interfaces).forEach((key) =>
Expand Down
6 changes: 2 additions & 4 deletions packages/vite/src/node/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -567,10 +567,8 @@ async function startServer(

if (hostname === '127.0.0.1') {
const url = `${protocol}://localhost:${chalk.bold(port)}${base}`
info(` > ${chalk.cyan(url)}`)
info(
` (run Vite with paramater --host 0.0.0.0 to listen to all network interfaces)`
)
info(` > Local: ${chalk.cyan(url)}`)
info(` > Network: ${chalk.dim('use `--host` to expose')}`)
} else {
const interfaces = os.networkInterfaces()
Object.keys(interfaces).forEach((key) =>
Expand Down