Wrong CSS mime type with Roundcube 0.5 beta and nginx

Posted by Julien Vehent on Server Fault See other posts from Server Fault or by Julien Vehent
Published on 2010-12-02T17:45:06Z Indexed on 2012/11/12 5:03 UTC
Read the original article Hit count: 579

Filed under:
|
|

I'm running into a CSS problem. This is a setup based on Debian Squeeze (nginx/0.7.67, php5/cgi) on which I installed the latest Roundcube 0.5 beta.

PHP is properly processed, login works fine but the CSS files are not loaded and Firefox is throwing the following errors:

Error: The stylesheet https://webmail.example.net:10443/roundcube/skins/default/common.css?s=1290600165

was not loaded because its MIME type, "text/html", is not "text/css". Source File: https://webmail.example.net:10443/roundcube/?_task=login Line: 0

Error: The stylesheet https://webmail.example.net:10443/roundcube/skins/default/mail.css?s=1290156319

was not loaded because its MIME type, "text/html", is not "text/css". Source File: https://webmail.example.net:10443/roundcube/?_task=login Line: 0

As far as I understand, nginx doesn't see the .css extension (because ofthe ?s= argument) and thus set the mime type with the default value, being text/html.

Should I fix this in nginx (and how ?) or is it roundcube's related ?

Edit: It seems that it's nginx related. The content-type isn't set for any other type than text/html. I had to include manually the following declarations to force CSS and JS content-types. That's ugly, and I never had the problem before... any idea ?

location ~ \.css {
    add_header  Content-Type    text/css;
}
location ~ \.js {
    add_header  Content-Type    application/x-javascript;
}

© Server Fault or respective owner

Related posts about debian

Related posts about nginx