Web.config on fresh install should include MIME map for woff2 fonts
See original GitHub issueDescription of problem
Certain themes bundle webfonts in a variety of formats. If IIS isn’t configured correctly they return a 404 error. If you’re hosting DNN on an Azure App Service the web.config file is the only way this can be achieved.
Description of solution
Include appropriate mime maps on the fresh unmodified web.config file. I believe we already handle .svg
and .woff
this way, so adding a new one seems like it ought to be fairly straightforward:
<system.webServer>
<staticContent>
<remove fileExtension=".svg" />
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
<remove fileExtension=".woff" />
<mimeMap fileExtension=".woff" mimeType="font/woff" />
<remove fileExtension=".woff2" />
<mimeMap fileExtension=".woff2" mimeType="font/woff2" />
</staticContent>
</system.webServer>
Screenshots
If applicable, provide screenshots to help explain your problem and/or feature.
Additional context
As far as I can tell, recent versions of IIS / Azure App Services handle .eot
and .ttf
font files without issue.
Affected version
- 9.2.2
- 9.2.1
- 9.2
- 9.1.1
- 9.1
- 9.0
Affected browser
Any .woff2 supporting browser.
- Chrome
- Firefox
- Safari
- Internet Explorer
- Edge
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:18 (18 by maintainers)
Top Results From Across the Web
Proper MIME type for .woff2 fonts
In IIS you can declare the mime type for WOFF2 font files by adding the following to your project's web.config: <system.
Read more >Adding Static Content MIME Mappings <mimeMap>
Overview The <mimeMap> element of the <staticContent> element adds a unique MIME type to the collection of static content types.
Read more >IIS8.5 woff2 Mimetype 404 on some pages
The woff2 fonts are loaded on the home page and some pages, however doesn't load on some other pages. Any ideas on what...
Read more >Configuring MIME types for a WordPress project in Azure ...
It was my first time using Microsoft Azure servers for hosting a WordPress project. I'm familiar with Apache and Nginx servers. Azure was...
Read more >Include more file types in web.config
config file that came with the experience to associate the woff2 file type with the application/font-woff2 mime type.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Suggestion, thinking out loud…
Leaving this here for future reference. What we need is to be able to account for older versions of IIS. WOFF2 is there for us nowadays in IIS 10 and later. You can read a lot about it here in this article from 2016.
Instead of debating this we should keep things simple. Once a mime type becomes pervasive and popular enough and it not yet in a version of IIS, DNN should be adding it, where it is missing, back to the oldest supported version of IIS.
This doesn’t need code or any complex solution (IMHO). We should just simply do something like this, Mozilla has a list of common mime types here. If we support DNN on a version of IIS (7+ at this time, right?) that does not include any of the common ones Mozilla lists, those (hopefully few) should be added. This would/will make life MUCH easier for administrators, hosters, developers, etc. I know I have lost a few hours over the years on these issues, and an approach like this seems easy to follow and implement moving forward.
Maybe there is a downside that I don’t see?
The official MIME type in the IANA standard and WOFF2 standard is
font/woff2