I am setting up my application to test with latest apache-tomcat-8.5.39. When I am trying to load my application on any web browsers few of my resources are not loading properly.
Few resources are not loading properly because of the content-type returned by the web server.
These resources are local resources (taking from servers) : ex:
CSS:
Request URL: http://localhost:8080/workflow/css/wfstyle.css Content-Type: text/html;charset=UTF-8
SVG:
Request URL: http://localhost:8080/workflow/images/svg/Delete.svg Content-Type: text/html; charset=UTF-8
But all CDN are loading properly
Request URL: https://cdn.abc.ocm/assets/1.5.1/css/abc-design-system-ltr.css content-type: text/css
This is how I am adding SVG to JSP pages:
<span class="esg-icon__container">
<img src="<%=request.getContextPath()%>/images/svg/Delete.svg"></img>
</span>
And CSS to JSP:
<%
if(request.getLocale().getLanguage().contains("ar")){
%>
<link href="https://cdn.abc.ocm/assets/1.5.1/css/abc-design-system-rtl.css" rel="stylesheet"/>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/abc-design-system-rtl-custom.css" />
<% } else { %>
<link href="https://cdn.abc.ocm/assets/1.5.1/css/abc-design-system-ltr.css" rel="stylesheet"/>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/abc-design-system-ltr-custom.css" />
<%}%>
web.xml from tomcat:
<mime-mapping>
<extension>svg</extension>
<mime-type>image/svg+xml</mime-type>
</mime-mapping>
Expected content-type
For CSS: content-type: text/css
For SVG: content-type: image/svg+xml