Title: LH HTTP/2 Server Push
Author: shawfactor
Published: <strong>2017 年 5 月 23 日</strong>
Last modified: 2017 年 5 月 25 日

---

搜索插件

![](https://ps.w.org/lh-http2-server-push/assets/banner-772x250.jpg?rev=1663161)

**该插件尚未通过WordPress的最新3个主要版本进行测试**。 当与较新版本的WordPress一起
使用时，可能不再受到维护或支持，并且可能会存在兼容性问题。

![](https://ps.w.org/lh-http2-server-push/assets/icon-256x256.png?rev=1662813)

# LH HTTP/2 Server Push

 作者：[shawfactor](https://profiles.wordpress.org/shawfactor/)

[下载](https://downloads.wordpress.org/plugin/lh-http2-server-push.zip)

 * [详情](https://cn.wordpress.org/plugins/lh-http2-server-push/#description)
 * [评价](https://cn.wordpress.org/plugins/lh-http2-server-push/#reviews)
 *  [安装](https://cn.wordpress.org/plugins/lh-http2-server-push/#installation)
 * [开发进展](https://cn.wordpress.org/plugins/lh-http2-server-push/#developers)

 [支持](https://wordpress.org/support/plugin/lh-http2-server-push/)

## 描述

Server Push provides significant performance gains if used judiciously. However 
other WordPress plugins that handle server push can actually slow your site as they
push files indiscrimentally.

Most push all files enqueued by wordpress to the broswer and use output buffering
to achieve this.

However this plugin does it properly by only pushing the the assets that the browser
requires for the initial user interaction. Namely the scripts and css in the head
of the document.

Note : It requires a web server that supports HTTP/2.

## 安装

 1. Upload the plugin files to the `/wp-content/plugins/lh-http2-server-push` directory,
    or install the plugin through the WordPress plugins screen directly.
 2. Activate the plugin through the ‘Plugins’ screen in WordPress

## 常见问题

  Installation Instructions

 1. Upload the plugin files to the `/wp-content/plugins/lh-http2-server-push` directory,
    or install the plugin through the WordPress plugins screen directly.
 2. Activate the plugin through the ‘Plugins’ screen in WordPress

  How do I know if this is working?

There are a couple ways:

 1. [nghttp](https://www.nghttp2.org/documentation/nghttp.1.html) is an HTTP/2 client
    that ships with the nghttp2 suite. `nghttp -v http://example.com` will show all
    the HTTP/2 signalling packets, HTTP headers, content, and resources sent from the
    server in a single request. You can see `PUSH PROMISE` signals from the server 
    and the pushed resources after the main page is sent.
 2. In Google Chrome, chrome://net-internals/#spdy will show a history of server connections
    from the browser. Clicking on a connection will show the discussion between the
    browser and the server. Within that text, you can see `PUSH PROMISE` packets and
    the pushed resources.

  Why aren’t some css styles in the head of thye document pushed?

The plugin relies on all assets being enqueued by the time the wp_enqueue_scripts
action is run. However css styles can be enqueued and still appear in the head as
late as the wp_print_styles action. This is porr design but IU can’t control other
plugins.

  Can I modify the urls that are pushed to the browser by this plugin?

Yes there is a filter lh_htt2_server_push_urls. This filter takes the input of an
associaytive array with the urls being the key and the file type being the value.
By using this filter you can add, remove or modify all the pushed urls.

## 评价

此插件暂无评价。

## 贡献者及开发者

「LH HTTP/2 Server Push」是开源软件。 以下人员对此插件做出了贡献。

贡献者

 *   [ shawfactor ](https://profiles.wordpress.org/shawfactor/)

[帮助将「LH HTTP/2 Server Push」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/lh-http2-server-push)

### 对开发感兴趣吗?

您可以[浏览代码](https://plugins.trac.wordpress.org/browser/lh-http2-server-push/)，
查看[SVN仓库](https://plugins.svn.wordpress.org/lh-http2-server-push/)，或通过[RSS](https://plugins.trac.wordpress.org/log/lh-http2-server-push/?limit=100&mode=stop_on_copy&format=rss)
订阅[开发日志](https://plugins.trac.wordpress.org/log/lh-http2-server-push/)。

## 更新日志

**1.00 May 15, 2017**
 Initial release.

**1.01 May 20, 2017**
 Is admin check.

**1.02 May 24, 2017**
 More robust code.

## 额外信息

 *  版本 **1.02**
 *  最后更新：**9 年前**
 *  活跃安装数量 **10+**
 *  WordPress 版本 ** 3.0 或更高版本 **
 *  已测试的最高版本为 **4.7.33**
 *  语言
 * [English (US)](https://wordpress.org/plugins/lh-http2-server-push/)
 * 标签
 * [http2](https://cn.wordpress.org/plugins/tags/http2/)[performance](https://cn.wordpress.org/plugins/tags/performance/)
   [prefetch](https://cn.wordpress.org/plugins/tags/prefetch/)[preload](https://cn.wordpress.org/plugins/tags/preload/)
   [server push](https://cn.wordpress.org/plugins/tags/server-push/)
 *  [高级视图](https://cn.wordpress.org/plugins/lh-http2-server-push/advanced/)

## 评级

尚未提交反馈。

[Your review](https://wordpress.org/support/plugin/lh-http2-server-push/reviews/#new-post)

[查看全部评论](https://wordpress.org/support/plugin/lh-http2-server-push/reviews/)

## 贡献者

 *   [ shawfactor ](https://profiles.wordpress.org/shawfactor/)

## 支持

有话要说吗？是否需要帮助？

 [查看支持论坛](https://wordpress.org/support/plugin/lh-http2-server-push/)