AVIF wrong mime type
nlemoine opened this issue · comments
Describe the bug
When generating AVIF images, they are sent to the client as the default mime application/octet-stream
instead of image/avif
.
To Reproduce
- Place an AVIF image on your server
- Request it from your browser
- Image gets downloaded because it's considered
application/octet-stream
Expected behavior
Image should open in the browser just like any other supported format.
Additional context
On a more global note, I would strongly advice to rely on https://github.com/h5bp/server-configs-nginx which is a well established, heavy commented, tested and community approved conf files for any nginx server. This would also takes away the pain of maintaining several aspects of nginx configuration (performance, security, keeping mime type up to date, etc.).
Maybe you could provide the basic by default and provide some way to enable/disable proposed configuration sections (for example: https://github.com/h5bp/server-configs-nginx/tree/main/h5bp/web_performance)?
@nlemoine does it require some configuration on the nginx vhost?
does it require some configuration on the nginx vhost?
What topic is the question about? :)
If your question is about my advice on using h5bp/server-configs-nginx, the configuration files targets both global nginx conf and eventually vhost conf.
In the global conf file, you'll probably want sane defaults such as:
- https://github.com/h5bp/server-configs-nginx/blob/main/nginx.conf#L58-L64
- https://github.com/h5bp/server-configs-nginx/blob/main/nginx.conf#L100
- Cache expiration might be too opinionated because it implies that your site handles cache busting correctly: https://github.com/h5bp/server-configs-nginx/blob/main/nginx.conf#L103
In the vhost conf file, the idea I proposed is to have an UI on the site editing screen (a couple of checkboxes that maps the h5bp/server-configs-nginx files) that allows you to enable/disable more specific features like:
- https://github.com/h5bp/server-configs-nginx/blob/main/h5bp/web_performance/pre-compressed_content_brotli.conf
- https://github.com/h5bp/server-configs-nginx/blob/main/h5bp/location/web_performance_filename-based_cache_busting.conf
- etc.
You can see an example of this implemented in ansible on the Trellis repo:
https://github.com/roots/trellis/blob/master/roles/wordpress-setup/templates/wordpress-site.conf.j2#L186-L208
I will check this later. For now I can say that we stick to the default configs shipping with Nginx.
For virtual hosts you have the ability to adjust them after the site being created in the site settings.
Sure 👍