首页/网络/协议速查/ALPN 应用层协议协商
本包目录(405 条)
HTTP 方法与状态码91 条HTTP 头与缓存70 条DNS 与域名解析60 条TCP 与 UDP54 条
TLS 与加密50 条
IP 与 ICMP37 条邮件与文件传输43 条

ALPN 应用层协议协商

在 TLS 握手里就商定上层协议(h2 / http/1.1 / h3),避免多一次往返探测;HTTP/2 浏览器连接基本都靠它。

协议速查网络更新于 2026-10-12

测试 ALPN

测试 ALPN
openssl s_client -connect example.com:443 -alpn h2 </dev/null 2>/dev/null | grep -i alpn
curl -v --http2 https://example.com 2>&1 | grep -i 'ALPN'
# 观察 HTTP/2: curl -sI --http2 https://example.com | head -1

协议标识

协议标识含义端口
h2HTTP/2 over TLS443/tcp
http/1.1HTTP/1.1443/tcp
h3HTTP/3 over QUIC443/udp
服务器未配置 ALPN h2 时,浏览器自动回落 http/1.1——「HTTP/2 没生效」先查 ALPN。

易错点

  • nginx 旧版本需要显式配置 http2 指令;只开 TLS 不协商 ALPN 则 HTTP/2 永远不会启用,抓包看 ClientHello 的 ALPN 扩展即可确认

数据来源与参考

  • RFC 7301(ALPN)
  • RFC 9113(HTTP/2)

相关工具

​‌‌​​‌​​​‌‌​‌‌‌‌​‌‌​​​‌‌​‌‌‌​​‌‌​​‌​‌‌‌​​‌‌‌​​​‌​‌‌​‌​​‌​‌‌‌​​​‌​‌‌​‌​​‌​‌‌​​​‌‌​‌‌‌​‌​​​‌‌​‌‌‌‌​​‌​‌‌‌​​‌‌​​​‌‌​‌‌​‌‌‌‌​‌‌​‌‌​‌