Stylesheet Not Parsed Because Non CSS Mime Types Are Not Allowed in Strict Mode

Stylesheet not parsed because non CSS MIME types are not allowed in strict mode

Note that you'll get that error if the page doesn't exist and your server is set to fallback or show some error page for non-existent pages.

Stylesheet not loaded because of MIME type

The issue, I think, was with a CSS library starting with comments.

While in development, I do not minify files and I don't remove comments. This meant that the stylesheet started with some comments, causing it to be seen as something different from CSS.

Removing the library and putting it into a vendor file (which is ALWAYS minified without comments) solved the issue.

Again, I'm not 100% sure this is a fix, but it's still a win for me as it works as expected now.

css files are not loaded because strict MIME checking is enabled when using spring security5

I found the solution, I had filter who was changing all files to "text/html"

public class CharacterSetFilter implements Filter {

public void destroy() {}

public void doFilter(
ServletRequest request,
ServletResponse response,
FilterChain next) throws IOException, ServletException {
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html; charset=UTF-8");//this line was the problem
response.setCharacterEncoding("UTF-8");
next.doFilter(request, response);
}

// ...

}



Related Topics



Leave a reply



Submit