Chrome 忽略 alt-svc header 并且不发送 HTTP/3 请求
Chrome ignores alt-svc header and doesn't send HTTP/3 requests
我一直在尝试在支持 HTTP/3 的本地主机上设置网络服务器。我已经在 docker 中成功地 运行 一个 caddy 服务器 运行,它用这个 header:
来回答 GET 请求
alt-svc: h3-27=":443"; ma=2592000
content-encoding: gzip
content-length: 1521
content-type: text/html; charset=utf-8
date: Thu, 07 May 2020 07:27:44 GMT
server: Caddy
status: 200
vary: Accept-Encoding
X-DNS-Prefetch-Control: off
即使收到 alt-scv header,我也无法在开发人员工具的网络日志中检测到任何 h3-27 请求。
还创建了一个 CA,我将其添加到 chrome,并签署了 Chrome 接受的服务器证书。我 运行 Chrome 带有标志 --enable-quic --quic-version="h3-27",如本 article. I've tried the same with an nginx server based on this image 并且无法使其正常工作。
我错过了什么?
Caddyfile:
{
experimental_http3
}
localhost {
root * /usr/share/caddy/
encode zstd gzip
templates
file_server
tls /etc/caddy/certs/localhost.crt /etc/caddy/certs/localhost.key
}
Caddy 输出:
2020/05/07 07:23:50.939 INFO using provided configuration {"config_file": "/etc/caddy/Caddyfile", "config_adapter": "caddyfile"}
2020/05/07 07:23:51.252 INFO admin admin endpoint started {"address": "tcp/localhost:2019", "enforce_origin": false, "origins": ["127.0.0.1:2019", "localhost:2019", "[::1]:2019"]}
2020/05/07 07:23:51 [INFO][cache:0xc00088da90] Started certificate maintenance routine
2020/05/07 07:23:51 [WARNING] Stapling OCSP: no OCSP stapling for [localhost bar.localhost]: no OCSP server specified in certificate
2020/05/07 07:23:51.254 INFO http skipping automatic certificate management because one or more matching certificates are already loaded {"domain": "localhost", "server_name": "srv0"}
2020/05/07 07:23:51.254 INFO http enabling automatic HTTP->HTTPS redirects {"server_name": "srv0"}
2020/05/07 07:23:51.255 INFO tls cleaned up storage units
2020/05/07 07:23:51.256 INFO http enabling experimental HTTP/3 listener {"addr": ":443"}
2020/05/07 07:23:51.257 INFO autosaved config {"file": "/config/caddy/autosave.json"}
2020/05/07 07:23:51.257 INFO serving initial configuration
自己找原因。 Chrome当前版本(Version 81.0.4044.138)不支持该版本的Quic(h3-27)。它可以通过使用 chrome-dev(版本 84.0.4136.5)来修复。
我一直在尝试在支持 HTTP/3 的本地主机上设置网络服务器。我已经在 docker 中成功地 运行 一个 caddy 服务器 运行,它用这个 header:
来回答 GET 请求alt-svc: h3-27=":443"; ma=2592000
content-encoding: gzip
content-length: 1521
content-type: text/html; charset=utf-8
date: Thu, 07 May 2020 07:27:44 GMT
server: Caddy
status: 200
vary: Accept-Encoding
X-DNS-Prefetch-Control: off
即使收到 alt-scv header,我也无法在开发人员工具的网络日志中检测到任何 h3-27 请求。
还创建了一个 CA,我将其添加到 chrome,并签署了 Chrome 接受的服务器证书。我 运行 Chrome 带有标志 --enable-quic --quic-version="h3-27",如本 article. I've tried the same with an nginx server based on this image 并且无法使其正常工作。
我错过了什么?
Caddyfile:
{
experimental_http3
}
localhost {
root * /usr/share/caddy/
encode zstd gzip
templates
file_server
tls /etc/caddy/certs/localhost.crt /etc/caddy/certs/localhost.key
}
Caddy 输出:
2020/05/07 07:23:50.939 INFO using provided configuration {"config_file": "/etc/caddy/Caddyfile", "config_adapter": "caddyfile"}
2020/05/07 07:23:51.252 INFO admin admin endpoint started {"address": "tcp/localhost:2019", "enforce_origin": false, "origins": ["127.0.0.1:2019", "localhost:2019", "[::1]:2019"]}
2020/05/07 07:23:51 [INFO][cache:0xc00088da90] Started certificate maintenance routine
2020/05/07 07:23:51 [WARNING] Stapling OCSP: no OCSP stapling for [localhost bar.localhost]: no OCSP server specified in certificate
2020/05/07 07:23:51.254 INFO http skipping automatic certificate management because one or more matching certificates are already loaded {"domain": "localhost", "server_name": "srv0"}
2020/05/07 07:23:51.254 INFO http enabling automatic HTTP->HTTPS redirects {"server_name": "srv0"}
2020/05/07 07:23:51.255 INFO tls cleaned up storage units
2020/05/07 07:23:51.256 INFO http enabling experimental HTTP/3 listener {"addr": ":443"}
2020/05/07 07:23:51.257 INFO autosaved config {"file": "/config/caddy/autosave.json"}
2020/05/07 07:23:51.257 INFO serving initial configuration
自己找原因。 Chrome当前版本(Version 81.0.4044.138)不支持该版本的Quic(h3-27)。它可以通过使用 chrome-dev(版本 84.0.4136.5)来修复。