Skip to content Skip to sidebar Skip to footer

Sec7113: Css Was Ignored Due To Mime Type Mismatch

I am developing a Jsp-Servlet application. I deployed the application using Eclipse with Default Tomcat 7. However after deploying the application, in Chrome/Firefox the UI gets re

Solution 1:

Ok,

I found that there's no way of doing from server side [tomcat] and tried with web.xml too. Then I found a workaround using a Filter Implementation

@OverridepublicvoiddoFilter(ServletRequest req, ServletResponse res, FilterChain chain)throws IOException, ServletException {
        HttpServletRequestrequest= (HttpServletRequest) req;
        HttpServletResponseresponse= (HttpServletResponse) res;
        if(request.getHeader("accept")!=null && request.getHeader("accept").contains("css")){
            response.setHeader("Content-Type", "text/css");
        }
        chain.doFilter(req, response);
    }

I explicitly set text/css for css requests. Then it's working fine.

Post a Comment for "Sec7113: Css Was Ignored Due To Mime Type Mismatch"