Nginx does not serve avif

Francis Daly francis at
Wed Sep 28 21:18:22 UTC 2022

On Wed, Sep 28, 2022 at 10:49:15AM +0200, Martin Wolfert wrote:

Hi there,

> i want to use new image files. That means: first serve (if available) avif,
> than webp and lastly jpg images.

>         location ~* ^/wp-content/.*/.*/.*\.(png|jpg)$ {
>                 add_header Vary Accept;
>                 try_files   $uri$img_ext $uri =404;
>         }

> Unfortunately ... Nginx does not serve avif files, if available. Tested it
> with the newest Chrome Versions.
> Anyone any idea where my error is located?

When you make the request for /dir/thing.png, do you want to get the file
/var/www/dir/thing.avif, or the file /var/www/dir/thing.png.avif?

The usual questions are:

What request do you make?
What response do you get?
What response do you want to get instead?


Francis Daly        francis at

More information about the nginx mailing list