我安装了支持 HTTP2 的 nginx。我的 nginx 在应用程序负载均衡器后面,SSL 终止仅在 LB 发生。
我首先启用了 HTTP2_PUSH,如下所示:
http2_push_preload on;
location /mx {
http2_push https://example.com/css/style.css;
http2_push https://example.com/js/main.js
}
但它没有用。我的浏览器调试器网络选项卡显示启动器是“索引”,而 nghttp 也没有显示任何内容。
我尝试的另一种方法是:
http2_push_preload on;
location /mx {
add_header Link "<https://example.com/css/style.css>; rel=preload; as=style,<http2_push https://example.com/js/main.js>; rel=preload; as=script";
}
下一个方法将启动器从网络选项卡更改index
为other
,但 nghttp 工具仍确认没有发生服务器推送。