From bcef647035cae5b8e39407ceaadb13bf7e3efd46 Mon Sep 17 00:00:00 2001 From: hinak0 Date: Thu, 8 Sep 2022 09:11:49 +0800 Subject: [PATCH] minor: default address changed to support both ipv4 and ipv6 --- README.md | 8 ++++---- bin/http-server | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0ffbbc1f..7d3f9291 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ This will install `http-server` globally so that it may be run from the command #### Globally via Homebrew brew install http-server - + #### As a dependency in your `npm` package: npm install http-server @@ -45,12 +45,12 @@ This will install `http-server` globally so that it may be run from the command | Command | Description | Defaults | | ------------- |-------------|-------------| |`-p` or `--port` |Port to use. Use `-p 0` to look for an open port, starting at 8080. It will also read from `process.env.PORT`. |8080 | -|`-a` |Address to use |0.0.0.0| +|`-a` |Address to use |`""`| |`-d` |Show directory listings |`true` | |`-i` | Display autoIndex | `true` | |`-g` or `--gzip` |When enabled it will serve `./public/some-file.js.gz` in place of `./public/some-file.js` when a gzipped version of the file exists and the request accepts gzip encoding. If brotli is also enabled, it will try to serve brotli first.|`false`| |`-b` or `--brotli`|When enabled it will serve `./public/some-file.js.br` in place of `./public/some-file.js` when a brotli compressed version of the file exists and the request accepts `br` encoding. If gzip is also enabled, it will try to serve brotli first. |`false`| -|`-e` or `--ext` |Default file extension if none supplied |`html` | +|`-e` or `--ext` |Default file extension if none supplied |`html` | |`-s` or `--silent` |Suppress log messages from output | | |`--cors` |Enable CORS via the `Access-Control-Allow-Origin` header | | |`-o [path]` |Open browser window after starting the server. Optionally provide a URL path to open. e.g.: -o /other/dir/ | | @@ -62,7 +62,7 @@ This will install `http-server` globally so that it may be run from the command |`--username` |Username for basic authentication | | |`--password` |Password for basic authentication | | |`-S`, `--tls` or `--ssl` |Enable secure request serving with TLS/SSL (HTTPS)|`false`| -|`-C` or `--cert` |Path to ssl cert file |`cert.pem` | +|`-C` or `--cert` |Path to ssl cert file |`cert.pem` | |`-K` or `--key` |Path to ssl key file |`key.pem` | |`-r` or `--robots` | Automatically provide a /robots.txt (The content of which defaults to `User-agent: *\nDisallow: /`) | `false` | |`--no-dotfiles` |Do not show dotfiles| | diff --git a/bin/http-server b/bin/http-server index 7c597fa8..fe045e7a 100755 --- a/bin/http-server +++ b/bin/http-server @@ -66,7 +66,7 @@ if (argv.h || argv.help) { } var port = argv.p || argv.port || parseInt(process.env.PORT, 10), - host = argv.a || '0.0.0.0', + host = argv.a || '', tls = argv.S || argv.tls, sslPassphrase = process.env.NODE_HTTP_SERVER_SSL_PASSPHRASE, proxy = argv.P || argv.proxy,