Skip to content

Web Fonts Mime Type is missing #6022

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

Closed
mtbadi39 opened this issue May 24, 2016 · 1 comment
Closed

Web Fonts Mime Type is missing #6022

mtbadi39 opened this issue May 24, 2016 · 1 comment
Labels
status: declined A suggestion or change that we don't feel we should currently apply

Comments

@mtbadi39
Copy link

mtbadi39 commented May 24, 2016

Similar to this, MimeMappings does not contain the Web Fonts Mime Types declaration.
When using Font Awesome and Bootstrap, my application generates this warnings :

JSF1091: No mime type could be found for file font-awesome/4.6.2/fonts/fontawesome-webfont.eot. To resolve this, add a mime-type mapping to the applications web.xml.
JSF1091: No mime type could be found for file bootstrap/3.3.6/fonts/glyphicons-halflings-regular.ttf. To resolve this, add a mime-type mapping to the applications web.xml.

Here is my current workaround :

@Component
public class ServletCustomizer implements EmbeddedServletContainerCustomizer {

    @Override
    public void customize(ConfigurableEmbeddedServletContainer container) {
        MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
        mappings.add("woff", "application/font-woff");
        mappings.add("woff2", "application/font-woff2");
        mappings.add("ttf", "application/x-font-truetype");
        mappings.add("eot", "application/vnd.ms-fontobject");
        mappings.add("svg", "image/svg+xml");
        mappings.add("otf", "application/x-font-opentype");
        container.setMimeMappings(mappings);
    }
}

Configuration :
Spring Boot 1.4.0.M3 with Embedded Tomcat
Primefaces 5.3 / Majorra 2.2.13
Webjars for bootstrap 3.3.6
Webjars for font-awesome 4.6.2

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 24, 2016
@wilkinsona
Copy link
Member

We need to draw the line somewhere as each mapping that we configure has a small cost so we configure the three embedded containers that we support (Tomcat, Jetty, and Undertow) with the union of the mime mappings that each of those containers provides by default. Put another way, none of the supported containers provides a mapping for eot or ttf by default so Spring Boot doesn't either.

@wilkinsona wilkinsona added status: declined A suggestion or change that we don't feel we should currently apply and removed status: waiting-for-triage An issue we've not yet triaged labels May 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined A suggestion or change that we don't feel we should currently apply
Projects
None yet
Development

No branches or pull requests

3 participants