Add avif image mime types to Nginx config #134

Closed
opened 2026-04-05 20:25:32 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @kimdre on 1/25/2025

CloudPanel version(s) affected

2.5.0

Description

The default nginx configuration does not include mime types for avif images.

I want to suggest to add them to prevent issues when viewing avif images directly.

With the current config (missing mime types), when you try to open a avif image in the browser, the content-type header will be set to application/octet-stream because nginx does not know how to handle the mime type, which causes the file to be downloaded instead of displayed as an image.

How to reproduce

  1. Go to website/page that has a avif image on it
  2. Right click, open image in new tab
  3. Images gets downloaded instead of displayed in new tab

Possible Solution

To fix this, add these to /etc/nginx/mime.types:

types {
    ...
    image/png                             png;
    image/tiff                            tif tiff;
    image/vnd.wap.wbmp                    wbmp;
    image/x-icon                          ico;
    image/x-jng                           jng;
    image/x-ms-bmp                        bmp;
    image/svg+xml                         svg svgz;
    image/webp                            webp;
+   image/avif                            avif;
+   image/avif-sequence                   avifs;

    application/font-woff                 woff;
    application/java-archive              jar war ear;
    ...

Additional Context

No response

*Originally created by @kimdre on 1/25/2025* ### CloudPanel version(s) affected 2.5.0 ### Description The default nginx configuration does not include mime types for avif images. I want to suggest to add them to prevent issues when viewing avif images directly. With the current config (missing mime types), when you try to open a avif image in the browser, the `content-type` header will be set to `application/octet-stream` because nginx does not know how to handle the mime type, which causes the file to be downloaded instead of displayed as an image. ### How to reproduce 1. Go to website/page that has a avif image on it 2. Right click, open image in new tab 3. Images gets downloaded instead of displayed in new tab ### Possible Solution To fix this, add these to `/etc/nginx/mime.types`: ```diff types { ... image/png png; image/tiff tif tiff; image/vnd.wap.wbmp wbmp; image/x-icon ico; image/x-jng jng; image/x-ms-bmp bmp; image/svg+xml svg svgz; image/webp webp; + image/avif avif; + image/avif-sequence avifs; application/font-woff woff; application/java-archive jar war ear; ... ``` ### Additional Context _No response_
MrUnknownDE added the improvement label 2026-04-05 20:25:32 +02:00
Sign in to join this conversation.