Node.Js: Resource Interpreted as Font but Transferred with MIME Type text/html

情到浓时终转凉″ 提交于 2020-01-13 08:33:07

问题


The icons on my website, which is being served up by Node.Js, are not rendering, and I am seeing the error indicated in the title. I am using this script for my server... https://github.com/joeeames/AngularFundamentalsFiles/blob/master/web-server.js

Below line 98 I added...

'woff':'application/font-woff'

I also...

npm install mime

But nothing I do seems to work. Does anyone know how how to solve this problem? The specific error from the console is...

Resource interpreted as Font but transferred with MIME type text/html: "https://<my_site>/bower_components/font-awesome/fonts/fontawesome-webfont.woff?v=4.1.0".

I see similar errors for TTF and SVG types.


回答1:


It probably means that you are requesting a resource that doesn't have a matching route, so the server is sending down the index page. If you look at the contents of the request in the developer tools of your browser, you should see that it is an html document that is being returned. You need to diagnose why what you are requesting doesn't have a matching route besides the default route that serves up the index.html page.



来源:https://stackoverflow.com/questions/25452126/node-js-resource-interpreted-as-font-but-transferred-with-mime-type-text-html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!