logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

http-server - a simple zero-configuration command-line http server

Copying

       Copyright  (c)  2011-2022  Charlie  Robbins,  Marak  Squires, and the Contributors.  Permission is hereby
       granted, free of charge, to any person obtaining a copy of this  software  and  associated  documentation
       files  (the  "Software"),  to  deal in the Software without restriction, including without limitation the
       rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the  Software,
       and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

       The  above  copyright  notice  and  this permission notice shall be included in all copies or substantial
       portions of the Software.

       THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  IMPLIED,  INCLUDING  BUT  NOT
       LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
       EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
       IN  AN  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
       THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Description

http-server  is  a  simple,  zero-configuration  command-line  http  server.  It  is  powerful enough for
       production usage, but it's simple and hackable enough to be used  for  testing,  local  development,  and
       learning.

Files

index.html will be served as the default file to any directory requests.

       404.html will be served if a file is not found. This can be used for SPA hosting to serve the entry page.

Name

       http-server - a simple zero-configuration command-line http server

Options

[PATH] The directory to serve.  Defaults to ./public if it exists, and ./ otherwise.

       -p,--portPORT
              Port to use. If 0, look for the first available port, starting at 8080.  Default is 8080.

       -aADDRESS
              Address to use.  Default is 0.0.0.0.

       -d     Show directory listings.  Default is true.

       -i     Display autoIndex.  Default is true.

       -g,--gzip
              Serve gzip files when possible.  Default is false.

       -b,--brotli
              Serve  brotli  files when possible.  If both brotli and gzip are enabled, brotli takes precedence.
              Default is false.

       -e,--extEXTENSION
              Default file extension is none is provided.

       -s,--silent
              Suppress log messages from output.

       --cors[HEADERS]
              Enable CORS via the "Access-Control-Allow-Origin" header.  Optionally provide  CORS  headers  list
              separated by commas.

       -o[PATH]
              Open  default browser window after starting the server.  Optionally provide a URL path to open the
              browser window to.

       -cTIME
              Cache time (max-age) in seconds.  To disable caching, use -c -1.  Default is 3600.

       -U,--utc
              Use UTC time format in log messages.

       --log-ip
              Enable logging of the client IP address.

       -P,--proxy
              Fallback proxy if the request cannot be resolved.

       --proxy-options
              Pass proxy options using nested dotted objects.

       --usernameUSERNAME
              Username  for  basic  authentication.   Can  also  be  specified  with  the  environment  variable
              NODE_HTTP_SERVER_USERNAME.  Defaults to none.

       --passwordPASSWORD
              Password  for  basic  authentication.   Can  also  be  specified  with  the  environment  variable
              NODE_HTTP_SERVER_PASSWORD.  Defaults to none.

       -S,--tls,--ssl
              Enable https.

       -C,--cert[FILE]
              Path to SSL certificate file.  If not specified, uses cert.pem.

       -K,--key[FILE]
              Path  to  SSL  key  file.   If  not  specified,  uses  key.pem.   Passphrase  will  be  read  from
              NODE_HTTP_SERVER_SSL_PASSPHRASE (if set)

       -r,--robots[USER-AGENT]
              Respond to /robots.txt request.  If not specified, uses "User-agent: *\nDisallow: /]"

       --no-dotfiles
              Do not show dotfiles.

       -h,--help
              Print usage and exit.

       -v,--version
              Print version and exit.

Synopsis

http-server [PATH] [OPTIONS]

Version

       Version 0.12.2

GNU                                                April 2020                                     http-server(1)

See Also