I am trying to implement http2_push to get the css sent with all the pages. Here is my sample code. I dont see the css being pushed yet. What am i doing wrong. Http2 is enabled.
我正在尝试实现HTTP2_PUSH,以获得与所有页面一起发送的CSS。以下是我的样例代码。我还没有看到css被推向市场。我做错了什么。Http2已启用。
location / {
#add_header Set-Cookie "session=1";
#add_header Link $push_resources;
proxy_pass http://xx.xxx.xxx.xx:6081;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Forwarded-Port 8080;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Country $geoip_country_code;
http2_push /pub/static/frontend/Archigrafix/basic/en_US/css/styles-l.css;
http2_push /pub/static/frontend/Archigrafix/basic/en_US/StripeIntegration_Payments/css/wallets.css;
http2_push /pub/static/frontend/Archigrafix/basic/en_US/Magefan_Blog/css/blog-custom.css;
http2_push /pub/static/frontend/Archigrafix/basic/en_US/Magefan_Blog/css/blog-m.css;
http2_push /pub/static/frontend/Archigrafix/basic/en_US/css/footer.css;
http2_push /pub/static/frontend/Archigrafix/basic/en_US/css/font-awesome.min.css;
http2_push /pub/static/frontend/Archigrafix/basic/en_US/css/header.css;
http2_push /pub/static/frontend/Archigrafix/basic/en_US/css/archigrafix.css;
http2_push /pub/static/frontend/Archigrafix/basic/en_US/css/navigationmenu.css;
http2_push /pub/static/frontend/Archigrafix/basic/en_US/css/theme.min.css;
http2_push /pub/static/frontend/Archigrafix/basic/en_US/css/styles-m.css;
}
更多回答
优秀答案推荐
Nginx removed push support in 1.25.1: https://forum.nginx.org/read.php?2,297538
NGINX在1.25.1中删除了推送支持:https://forum.nginx.org/read.php?2,297538
As did Chrome for reasoned explained in this post (full disclosed, I authored this Chrome post):
https://developer.chrome.com/blog/removing-push/
正如Chrome for reasoned在这篇文章中所解释的那样(完全披露,我撰写了这篇Chrome文章):https://developer.chrome.com/blog/removing-push/
General consensus is that HTTP/2 Push is too difficult to get right and shouldn’t be used.
普遍的共识是,HTTP/2推送太难正确使用,不应该使用。
更多回答
我是一名优秀的程序员,十分优秀!