We migrated our web servers to Nginx mainly for performance reason, flexibility and ease of configuration (In this regard, a great load of satisfaction!).
However, only one site showed a strange behavior: it loads in its <head>
a CSS
<link type="text/css" rel="stylesheet" href="/css/appli-test-local/appli.css">
and Firefox refuses to load the CSS file, complaining that the mime type is not css
The stylesheet http://client...com/css/appli-test-local/appli.css was not loaded because its MIME type, "text/html", is not "text/css".
while removing the dashes -
works
<link type="text/css" rel="stylesheet" href="/css/applitestlocal/appli.css">
Nginx config
Regarding the Nginx config, its has been checked several times, against the numerous examples on the Net, the mime.types
file contains
text/html html htm shtml;
text/css css;
and the nginx.conf for the main part
http {
include /etc/nginx/mime.types;
include /etc/nginx/fastcgi.conf;
default_type application/octet-stream;
Is it likely to be a bug in Nginx having a hard time with dashes? Nginx being a well written piece of software, I'd be surprised, but it could be.
Do I miss something obvious?
The problem happens only in Firefox, because FF does care about the mime types (which is a good thing!).
Best Answer
If you installed Nginx through your default distro repo then you're most likely using a very outdated version of Nginx which might very well contain such a bug.
For testing you should try either finding an updated repo or compiling the latest version from source. If that does not help then paste server OS and whole config file.