Fixed Weblogic Apache Bridge CSS Mimetype

Published:

After switching our jsp pages to render in w3c transitional mode (by adding the doctype to our pages), the css files stopped working in firefox. I found that the css files were being served with an incorrect mime-type of text/html instead of the required text/css from the firefox page info. (IE apparently guesses the mimetype for you, which is against the w3c spec but get’s your pages to show correctly.)

Our first check was the Apache config, which appeared correct. Next was a web search where I found some links to the apache weblogic bridge. The bridge incorrectly places a text/html mimetype on everything. We fixed this by putting the mime mapping into the web.xml file of our webapp. Everything works beautifully again!

Here’s the mapping that needs to be added:

<mime-mapping>
  <extension>css</extension>
  <mime-type>text/css</mime-type>
</mime-mapping>