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
feat(cli): The --host flag can be run without arguments
  • Loading branch information
eirslett committed May 2, 2021
commit a388e27c3b9508624e00b296fa1dd224aa203247
9 changes: 8 additions & 1 deletion docs/config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,15 @@ export default async ({ command, mode }) => {
### server.host

- **Type:** `string`
- **Default:** `'127.0.0.1'`

Specify server hostname.
Specify server hostname, used to specify which IP addresses the server
will be available on.
In order to open the server for traffic from other machines, you can
set this to `'0.0.0.0'`.

It is also possible to set this from the CLI using `--host 0.0.0.0`
or just `--host`.
eirslett marked this conversation as resolved.
Show resolved Hide resolved

### server.port

Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/node/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ cli
cli
.command('[root]') // default command
.alias('serve')
.option('--host <host>', `[string] specify hostname`)
.option('--host [host]', `[string] specify hostname`)
.option('--port <port>', `[number] specify port`)
.option('--https', `[boolean] use TLS + HTTP/2`)
.option('--open [path]', `[boolean | string] open browser on startup`)
Expand Down