用于开发的简单 HTTP/2 服务器
simplehttp2server 在支持 HTTP/2.0 的服务器上服务当前目录。此服务器仅用于开发目的。simplehttp2server 接收 JSON 配置文件,允许您以轻量级 JSON 格式配置头、重定向和 URL 重写。格式部分与 [Firebase 的 JSON 配置] 兼容。请参阅下面的 免责声明。
如果已设置 Docker,则可以使用以下命令通过 simplehttp2server 服务当前目录:
$ docker run -p 5000:5000 -v $PWD:/data surma/simplehttp2server [-config firebase.json]从要服务的目录中运行 simplehttp2server 命令,然后访问 https://localhost:5000
simplehttp2server [options]
options:
-config string Config file
-cors string Set allowed origins (default "*")
-listen string Port to listen on (default ":5000")当您浏览到服务器的地址(最有可能是 `https://localhost:5000``)时,您可能会收到类似以下内容的警告,表示连接不安全:
这是正常且正确的,因为 simplehttp2server 生成的证书是自签名的,不包含任何通用证书颁发机构(CA)的签名。所有浏览器都提供了暂时忽略此错误并继续的方法。这样做是安全的。使用 Chrome 时,您可以在 chrome://flags 中启用 [allow-insecure-localhost 标志],这将禁用 localhost 的证书警告。**如果您想在 https://localhost 上使用 ServiceWorker 并使用自签名证书,则需要启用此标志。
暂无开放 Issues,或尚未同步最近议题。