Server Push is a method of information delivery whereby a server pushes a resource directly to the client without first receiving a request to do so. By doing this, the server can attempt to anticipate client requests and pre-push them into the client’s cache in an effort to avoid the usual request-response round trip delay.
NOTE: This article focuses on HTTP/2 server push, but server push may also be used with HTTP/3, assuming the browser supports it.
We are going to introduce how to verify Server Push with WordPress+LSCache, and then with Cloudflare.
If you would like to try server push and file making from scratch, please see this guide to learn how.
There are two easy ways to verify your browser has HTTP/2 support:
ON
ON
We are going to use the Chrome developer tool as our verification tool.
CSS and JS files will show as Push / Other
:
Next we'll try it with Cloudflare. Cloudflare supports HTTP/2 Server Push with the link
header field on all plan levels. Cloudflare will look for the link
header field, in response headers from the origin server and extract URI-references with parameters rel=preload
. These URI will be pushed to the client.
Follow this LiteSpeed blog to Set up CDN from LSCache
chrome://net-internals/#http2
rel=preload; as=style,</wordpress/wp-content/plugins/litespeed-cache/css/litespeed.css>; rel=preload; as=style,</wordpress/wp-includes/js/admin-bar.min.js>;
We welcome your feedback on our forum.
If you want to disable the ls_smartpush
cookie for a particular domain, you can use the SmartPush no-cookie
directive in .htaccess
starting from LSWS v5.4.2.
<IfModule LiteSpeed> SmartPush no-cookie </IfModule>
After you make changes to .htaccess
, you will need to restart your browser to avoid getting a cached version. After that, you should see something like the following: