WebP is a new image format created by Google that can be used on your site in place of more traditional image types such .jpg's and .png files.


There are now a number of WordPress plug-ins that allow you to utilise WebP files for you website such as WP-Rocket. However as this is such a new format not all browsers support the new file type. For compatibility reasons you may still want to serve jpg files to users with browsers that don't support the new WebP image type but serve WebP files to those that do. In order for this to work correctly on STORM we've built a feature that lets you both get the benefits of Nginx caching for static which is built into STORM and WP-Rockets WebP feature.


How it works


WP-Rocket's WebP feature works by creating a WebP copy of all the sites images and at the same time maintains a copy of the original .jpg file. This allows browsers that don't support WebP files to load the jpg copy of the images and browsers that do get served the WebP files.


As you may be aware, STORM has a feature that allows you to server static files from Nginx. See the following link for further details:


What web server does STORM use?


Due to this, we have added the following option inside STORNM that allows you to use the WP-Rocket WebP feature work alongside the Nginx caching for static file feature built into STORM. You can find this on your sites configuration page.




What does it do?


Toggling on the WebP support for WordPress option in STORM makes some adjustments to the sites Nginx config as detailed below: 


location ~* ^(/wp-content/.+)\.(png|jpg)$ {
    set $base $1;
    set $webp_uri $base$webp_suffix;
    set $root /sites/storm/websitename/public;
    root $root;
    add_header Vary Accept;
    try_files $webp_uri $uri =404;
}