-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Add avif images to default known static file MIME types #39984
Comments
See previous responses for similar requests: |
I saw the comment in the file. I my honest opinion an increasingly widespread image format is more important for web developers than product specific files types like |
Triage: we don't think this meets the bar yet for adding by default (especially given that this is the first request we've had for it). You can always add it yourself in your code. We'd reconsider if there were a lot more demand. Will leave this in Backlog to allow for more comments/upvotes. |
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process. |
I'd like to add that avif files are significantly smaller than jpg of similar resolution. I switched over to using them to greatly improve my LCP metric with Google to improve my site page rank. Just swapping out a header background jpg with an avif saved me almost 2 seconds of load time on the LCP test for mobile Chrome. This file format should be gaining widespread adoption soon. I don't think it's a good idea to have devs tear their hair out trying to figure out why an image asset is returning 404 despite having all the file properties set correctly. I didn't even know that an asset in the wwwroot folder or subfolders could return a 404 until I found this issue. |
I'm going to disagree here @adityamandaleeka. Windows itself supports it, as does php, android, chrome and edge. We should add it, along with HEIC/HEIF. The usage of these types is more common than a bunch of the office formats we listed when we inherited the list from IIS, or the now dead silverlight ones :) |
@blowdart - Thank you. Some sanity has returned to this thread. We shouldn't need a choir of developers requesting support for ASP.NET to serve Avif images by default at a time when ALL major browsers support rendering the Avif image format. See https://caniuse.com/avif Honestly, every time I see Microsoft so late to the party on new industry standards, I question whether I bet my development career on the right company. (shrug) Come on, we can do better than this. |
For others that end up here wondering how to get the static file middleware in .NET 8 (or earlier) to srve avif files, I'll save you a bit of research. This is working for me:
|
Will this ever be considered? Maybe there should be a more obvious way of configuring what file mappings are used. |
@rclabo Answer helped me, but I'm serving up an Angular SPA via IIS alongside a dotnet core API. I had to use:
Took me a bit to come around to the issue being aspnetcore; I had already added the MIME type to IIS. |
Wow, it is a bit disappointing to discover the state of this.
This sounds subjective and it is unclear when this ever will happen (who decides how many developers are a majority?). But imho this is also wrong way to look at it. Support for new static/mime types should be added when it becomes clear a majority browsers are supporting or are going to support these types. You are developing a web server technology. I assume you want the server technology to be up to date, this would include supporting the latest browser trends since that is what the web server technology is being used with. At least as developer using asp net core (and being happy to use it) I hope you do. As a side note: a point of discussion would be if you need to wait until most browsers support a new type or if some browsers start to support it. Because it is still the responsibility of the developer using asp net core if they want to use a more exotic (not widely supported) type. It is also only the developer that has to deal with any problems arising from this decision. |
I don't have an objection to considering this again. Thanks to everyone who has chimed in on this issue. |
Is there an existing issue for this?
Is your feature request related to a problem? Please describe the problem.
When developing web applications, the size of images is always a factor. Therefore I decided to use the avif file format. When running my web application (Angular + WebApi) with Kestrel, I have to manually add the MIME type to the
FileExtensionContentTypeProvider
otherwise the static file isn't served.Describe the solution you'd like
Please add the extension (
.avif
) and the MIME type (image/avif
) to the dictionary inFileExtensionContentTypeProvider
.I can open a PR if wanted.
Additional context
In 2019 the specifications for the avif image format have been released. Meanwhile the format is well supported for example by Chrome, Firefox, Windows, Linux and Android. It is a good candidate for being a successor of jpeg, png and webp also with regard to the open licence.
The text was updated successfully, but these errors were encountered: