Skip to content

Site Health: detect web server AVIF mime type support #1263

@adamsilverstein

Description

@adamsilverstein

Feature Description

When the server supports AVIF processing, add detection in site health to check if AVIF images are being served with the avif type or with octet-stream. Warn users when avif isn't being used. Consider attempting to apply fix via .htaccess?

Details

Since launching AVIF support in WordPress 6.5, some users are discovering that their AVIF images are being served with the network type "octet-stream". The impact is relatively low since browsers know to serve these .avif files as AVIF images, however it is worth trying to detect and fix if possible.

Examples

The website https://ground-cd.com/blog/avif/ uses AVIF images, checking the network panel the type shows as "octet-stream" instead of "avif".
image

On the other hand, this site serves up AVIF images correctly, with the avif type: https://aomedia.org/blog%20posts/avif-meet-the-next-level-image-file-format/
image

Underlying issue

This issue can happen if the web server does not include the image/avif MIME types in its configuration. For Apache, the host may have a custom config, and configurations could (possibly) be added via .htaccess

Nginx added AVIF to their base config in 2021 (PR).

Apache config would probably be host or distribution dependent, so these might need updating. For Apache, I opened this PR to add it to their config. Users can ask their hosts to add the configuration and this is a very low risk change for hosts.

Suggested fix

  • Add detection for the file type served when an AVIF image is loaded and warn users when the type is not correct
  • Offer/try to fix the issue automatically (?)
  • Maybe no need to run test if server doesn't support AVIF
  • Suggest users ask their hosts add support and link to docs

Metadata

Metadata

Labels

Good First IssueIssue particularly suitable to be worked on by new contributors[Plugin] Performance LabIssue relates to work in the Performance Lab Plugin onlyno milestonePRs that do not have a defined milestone for release

Type

No type

Projects

Status

Done 😃

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions