【发布时间】:2019-08-11 02:16:41
【问题描述】:
我安装了支持 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 工具仍然确认没有发生服务器推送。
【问题讨论】: