简体   繁体   English

NGINX http2 推送一个 VUE SPA

[英]NGINX http2 push for a VUE SPA

I would like to use the http2 server push in publishing a VUE SPA.我想在发布 VUE SPA 时使用 http2 服务器推送。 I found this interesting article and tried to use: http2_push_preload on , in publishing the VUE SPA.我发现这篇有趣的文章并尝试使用: http2_push_preload on ,发布 VUE SPA。

location / { 
try_files $uri $uri/ /index.html =404; 
http2_push_preload on; 
}

But it does not work, as using nghttp -ans https://mysite/index.html returns a response where none of the resources listed is annotated with an asterisk.但它不起作用,因为使用nghttp -ans https://mysite/index.html返回一个响应,其中列出的资源都没有用星号注释。

What it was wrong?出了什么问题?

Make sure you enable http2确保启用 http2

server {
    listen 443 ssl http2;
}

Note that accepting HTTP/2 connections over TLS requires the “Application-Layer Protocol Negotiation” (ALPN) TLS extension support, which is available only since OpenSSL version 1.0.2.请注意,通过 TLS 接受 HTTP/2 连接需要“应用层协议协商”(ALPN) TLS 扩展支持,该扩展仅在 OpenSSL 版本 1.0.2 起可用。 Using the “Next Protocol Negotiation” (NPN) TLS extension for this purpose (available since OpenSSL version 1.0.1) is not guaranteed to work.不保证为此目的使用“下一个协议协商”(NPN)TLS 扩展(自 OpenSSL 版本 1.0.1 起可用)不保证有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM