zeit serve 命令不允许在 url 上显示“index.html”字符串
zeit serve command is not allowing `index.html` string showing on url
我正在使用 Zeit serve
我的文件夹有一个非常基本的index.html
文件。
现在,如果我导航到该文件夹,然后键入 serve
命令并按回车键,serve
会为我启动一个网站。
我的问题来了,我可以毫无问题地导航到/
,但是当我想导航到
时
/index.html
serve
立即将我的 URL 路径重定向到 /
.
如果 URL 包含字符串 index.html
,我如何告诉 serve
不要重定向我的 URL?
我有运行serve -h
,但还是不知道怎么修改
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
这是 Zeit 服务的 "feature" -> 在一个仍未解决的问题中阅读更多关于此 "problem" 的信息(关于 url 的解析还有很多其他问题):
https://github.com/zeit/serve/issues/431
我正在使用 Zeit serve
我的文件夹有一个非常基本的index.html
文件。
现在,如果我导航到该文件夹,然后键入 serve
命令并按回车键,serve
会为我启动一个网站。
我的问题来了,我可以毫无问题地导航到/
,但是当我想导航到
/index.html
serve
立即将我的 URL 路径重定向到 /
.
如果 URL 包含字符串 index.html
,我如何告诉 serve
不要重定向我的 URL?
我有运行serve -h
,但还是不知道怎么修改
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
这是 Zeit 服务的 "feature" -> 在一个仍未解决的问题中阅读更多关于此 "problem" 的信息(关于 url 的解析还有很多其他问题):
https://github.com/zeit/serve/issues/431