Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avif images served with incorrect Content-Type header #1888

Open
gagan0123 opened this issue Dec 3, 2024 · 2 comments
Open

Avif images served with incorrect Content-Type header #1888

gagan0123 opened this issue Dec 3, 2024 · 2 comments

Comments

@gagan0123
Copy link

Description

I am using EasyEngine to host a WordPress website that utilizes the Modern Image Formats plugin to convert images to WebP and Avif formats. While WebP images are served correctly, Avif images are being served with an incorrect Content-Type header (application/octet-stream instead of image/avif).

Steps to Reproduce:

  1. Install EasyEngine on a server.
  2. Create a WordPress site using EasyEngine.
  3. Install the Modern Image Formats plugin.
  4. Configure the plugin to convert images to WebP and Avif.
  5. Upload an image and observe the Content-Type header for the generated Avif version.

Expected Behavior:

Nginx should serve Avif images with the Content-Type: image/avif header.

Actual Behavior:

Nginx is serving Avif images with the Content-Type: application/octet-stream header.

Additional Information:

Suggested Solution:

Update EasyEngine's Nginx configuration to include the following line within the server block:

location ~* \.(avif)$ {
  add_header Content-Type image/avif;
}
@gagan0123
Copy link
Author

Also the Cache-Control header for avif images will need an update.

@gagan0123
Copy link
Author

As a temporary solution, I've transformed the response header via Cloudflare to output correct value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant