wp-media / imagify-plugin

Speed up your website with lighter images without losing quality.
https://imagify.io
73 stars 27 forks source link

R&D for NGINX AVIF/WEBP rewrite rules #821

Closed MathieuLamiot closed 8 months ago

MathieuLamiot commented 9 months ago

We need to do a research related to AVIF/WEBP NGINX rewrite rules. The objective is for them to work on:

  1. Local NGINX environments
  2. Our WordOps environment

The AC:

  1. When browser accepts AVIF and WebP, the order of displaying should be 'AVIF > WEBP > Optimized Image'
  2. If browser doesn't accept AVIF, we should display: 'WEBP > Optimized Image'
  3. If browser doesn't accept WEBP, we should display 'Optimized image'
  4. It should be possible by adding the rewwrite rules only to the server directive

There is no possibility that the browser accepts AVIF but no WEBP: https://caniuse.com/?search=webp https://caniuse.com/?search=avif