Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Redis full page caching & webp conditional image serving #95
Latest Pagespeed (Lighthouse) tool's update, suggests webp content type to be served onto supported browsers.
Since major browsers like Safari are not supporting webp yet, a conditional cached version is required both for webp supporting browsers and a second for non-webp supporting ones.
Are there any solutions for this problem yet? If a page is cached from a webp supporting browser, non-webp browsers will see this cached version aswell.
Mapping useragent in nginx an appending the variable to cache key, after conditionally checking the variable, might do the trick.
Then, just append $nowebpsupport in your cache key, depending on the config you are using ( /etc/nginx/common/redis-php73.conf for Redis/PHP7.3 ):
WebP images support is already implemented in WordOps :
It work properly with full page caching, as we are not serving images with the .webp extension, but directly with their original extension and the proper content-type header depending on the browser request headers.
This configuration do not work with Cloudflare.
You can use the approach below to customize the thumbnail output.
Recommend to use some plugin like EWWW Image optimizer
I think it's great that the webp is served if the image is available. However this will cause serious problems if someone is using cloudflare or any kind of cdn. The cdn will cache the webp version of the .jpeg and serve it to non compatible browsers. So I don't know if this should be on by default, it should be an installation choice.
- PHP 7.4 support - Improved Webp images support with Cloudflare (Issue [#95](#95)). Nginx will not serve webp images alternative with Cloudflare IP ranges. - Stack upgrade for adminer - Check acme.sh installation and setup acme.sh if needed before issuing certificate - Add `--ufw` to `wo stack status` - Add Nginx directive `gzip_static on;` to serve precompressed assets with Cache-Enabler or WP-Rocket. (Issue [#207](#207)) - Previous `--php73` & `--php73=off` flags are replaced by `--php72`, `--php73`, `--php74` to switch site's php version - phpMyAdmin updated to v4.9.2 - Adminer updated to v4.7.5 - Replace dot and dashes by underscores in database names (Issue [#206](#206)) - Increased database name length to 32 characters from domain name + 8 random characters - typo error in motd-news script (Issue [#204](#204)) - Install Nginx before ngxblocker - WordOps install/update script text color - Issue with MySQL stack on Raspbian 9/10 - Typo error (PR [#205](#205)) - php version in `wo debug` (PR [#209](#209)) - SSL certificates expiration display with shared wildcard certificates