SatelliteWP / rocket-nginx

Rocket-Nginx is a Nginx configuration that makes WP-Rocket even faster by serving static pages directly without loading WordPress or PHP.
MIT License
579 stars 129 forks source link

X-Rocket-Nginx-Serving-Static: MISS when WebP Compatibility add-on enabled #207

Closed LSB-Web-Design closed 11 months ago

LSB-Web-Design commented 11 months ago

Describe the bug When using the Webp compatability add-on and webp images are being used on the page WP Rocket generates a file name like index-https-webp.html that can be served to webp compatible browsers.

The problem here is rocket-nginx looks for the file index-https.html and not index-https-webp.html. So using a modern browser that supports webp leads to X-Rocket-Nginx-Serving-Static: MISS because it is looking for index-https.html

The index-https.html file is only generated if someone visits the page on a non webp compatible browser which should be extremely rare these days. If that index-https.html file is found it would cause a problem anyway because on the webp compatible brower we want the index-https-webp.html version.

Versions Ubuntu 18.04 x64 Rocket-Nginx 3.0.2 Latest version of WP Rocket

To Reproduce Steps to reproduce the behaviour:

  1. Enable the webp addon
  2. Add some webp images to your page or setup a plugin like Webp Express
  3. Using a modern browser that supports webp clear the cache and reload the page a couple of times
  4. You should see X-Rocket-Nginx-Serving-Static: MISS instead of HIT

Expected behavior If the Wp Rocket webp addon is enabled then the webp version of the cached page (index-https-webp.html) should be found resulting in a HIT, instead of it looking for the non webp version.

maximejobin commented 11 months ago

Webp is supported by all modern browsers. It has been for a couple of years now.

If you really want to use this feature, you can add the proper script using the $rocket_support_webp variable.

Reference: https://caniuse.com/webp

LSB-Web-Design commented 11 months ago

Yeah it doesn't bother me too much and I am happy to ignore older browser that don't support it on my own website. I've just had a couple of clients in the past where customers have contacted them saying they can't see images because they are webp and they're using an old iOS version.