简体   繁体   中英

zeit serve command is not allowing `index.html` string showing on url

I'm using Zeit serve

My folder has a very basic index.html file.

Now, if I navigate to that folder, and type serve command and hit enter, serve starts a website for me.

Here comes my question, I can navigate to / with no problem, but when I want to navigate to

/index.html

serve immediately redirect my URL path to / .

How can I tell serve not to redirect my URL if it contains string index.html ?

I have run serve -h , but I still don't know how to modify it.


  serve - Static file serving and directory listing

  USAGE

      $ serve --help
      $ serve --version
      $ serve folder_name
      $ serve [-l listen_uri [-l ...]] [directory]

      By default, serve will listen on 0.0.0.0:5000 and serve the
      current working directory on that address.

      Specifying a single --listen argument will overwrite the default, not supplement it.

  OPTIONS

      --help                              Shows this help message

      -v, --version                       Displays the current version of serve

      -l, --listen listen_uri             Specify a URI endpoint on which to listen (see below) -
                                          more than one may be specified to listen in multiple places

      -d, --debug                         Show debugging information

      -s, --single                        Rewrite all not-found requests to `index.html`

      -c, --config                        Specify custom path to `serve.json`

      -n, --no-clipboard                  Do not copy the local address to the clipboard

      -u, --no-compression                Do not compress files

      --no-etag                           Send `Last-Modified` header instead of `ETag`

      -S, --symlinks                      Resolve symlinks instead of showing 404 errors

      --ssl-cert                          Optional path to an SSL/TLS certificate to serve with HTTPS

      --ssl-key                           Optional path to the SSL/TLS certificate's private key

  ENDPOINTS

      Listen endpoints (specified by the --listen or -l options above) instruct serve
      to listen on one or more interfaces/ports, UNIX domain sockets, or Windows named pipes.

      For TCP ports on hostname "localhost":

          $ serve -l 1234

      For TCP (traditional host/port) endpoints:

          $ serve -l tcp://hostname:1234

      For UNIX domain socket endpoints:

          $ serve -l unix:/path/to/socket.sock

      For Windows named pipe endpoints:

          $ serve -l pipe:\\.\pipe\PipeName

This is a "feature" of Zeit serve -> read more about this "problem" in a still open issue (there are tons of others, regarding resolution of urls):
https://github.com/zeit/serve/issues/431

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM