3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Bootstrap3を利用した際、Chromeのデバッグトレースで、拡張子woff2のフォントを読み込もうとしてResource interpreted as Font but transferred with MIME type text/plainがスローされるときの対処

Posted at

タイトルが長いですが… 拡張子 woff2 の…コンテンツが読めなかったのでテキストで読みました、とトレースログが出ます。

これの解決法は、Webサーバないしばアプリケーションサーバにてmimeマッピングを追加するだけです。

Apache Tomcatであれば、サーバのweb.xmlを開き、<mime-mapping>あたりですね。woffでファイル内を検索するとすぐに見つかります。

web.xml
    <mime-mapping>
        <extension>wmz</extension>
        <mime-type>application/x-msmetafile</mime-type>
    </mime-mapping>
    <mime-mapping>
        <extension>woff</extension>
        <mime-type>application/x-font-woff</mime-type>
    </mime-mapping>
    <mime-mapping>
        <extension>wpd</extension>
        <mime-type>application/vnd.wordperfect</mime-type>
    </mime-mapping>

こうなっていますので、次のようにwoff2を追記します。

web.xml
    <mime-mapping>
        <extension>wmz</extension>
        <mime-type>application/x-msmetafile</mime-type>
    </mime-mapping>
    <mime-mapping>
        <extension>woff</extension>
        <mime-type>application/x-font-woff</mime-type>
    </mime-mapping>
    <mime-mapping>
        <extension>woff2</extension>
        <mime-type>application/x-font-woff</mime-type>
    </mime-mapping>
    <mime-mapping>
        <extension>wpd</extension>
        <mime-type>application/vnd.wordperfect</mime-type>
    </mime-mapping>
3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?