Opened 7 years ago

Closed 6 years ago

Last modified 6 years ago

#306 closed defect (fixed)

mime.types outdated

Reported by: aitte.myopenid.com Owned by: pluknet
Priority: minor Milestone:
Component: nginx-core Version: 1.2.x
Keywords: mime mime.types Cc:
uname -a: 2.6.32-279.22.1.el6.x86_64
nginx -V: nginx version: nginx/1.2.7 built by gcc 4.4.4 20100726 (Red Hat 4.4.4-13) (GCC)

Description

/etc/nginx/mime.types delivers .js files as "application/x-javascript"

According to the RFC (http://www.rfc-editor.org/rfc/rfc4329.txt) it should be "application/javascript" and x-javascript is discouraged by the RFC.

That one definitely needs fixing. Other types in mime.types may need fixing too. This is just the one I know of. It may be time to go through the entire list to verify that it's all correct.

Change History (10)

comment:1 Changed 7 years ago by aitte.myopenid.com

Summary of fixes:

Follow RFC:
application/javascript js;

Add support for WebFonts?:
application/vnd.ms-fontobject eot; (http://www.iana.org/assignments/media-types/application/vnd.ms-fontobject)
application/x-font-ttf ttf; (this is the most common mime type for it)
application/x-font-woff woff; (the standard will be application/font-woff but this is the correct value for now and is understood by Google Chrome: http://code.google.com/p/chromium/issues/detail?id=70283#hc3)
application/x-font-opentype otf;

Version 0, edited 7 years ago by aitte.myopenid.com (next)

comment:2 Changed 7 years ago by aitte.myopenid.com

I discovered that .eot is currently registered in mime.types as:

application/octet-stream eot;

This is definitely wrong. It's been officially registered as application/vnd.ms-fontobject.

Combine this with the way that javascript was being served with the deprecated application/x-javascript, and I think it's important that the whole file be re-evaluated to make sure it's correct.

The http://www.iana.org/assignments/media-types site will help with official answers for all registered file types. The rest will have to be found via Google to figure out what the correct mime types for them are.

Last edited 7 years ago by aitte.myopenid.com (previous) (diff)

comment:3 Changed 7 years ago by aitte.myopenid.com

Have a look at the HTML5Boilerplate project; I just discovered that they have an Nginx config sub-project containing the fixes I mentioned and more:

https://github.com/h5bp/server-configs/blob/master/nginx/mime.types

Their config file is good enough that it even deserves to become the official Nginx mime.types file. They're dedicated to doing Best Practices in everything. For instance, the official Nginx mime.types file serves .rss as "application/rss+xml", which is indeed the correct official mime type, but does not work in all browsers. So they went with "application/xml" instead, which is the most widely supported. Their project is full of that kind of attention to detail (their project goal is to do what works best in *every* browser) and is a better mime.types than what's shipped with Nginx.

Last edited 7 years ago by aitte.myopenid.com (previous) (diff)

comment:4 Changed 7 years ago by glebius.myopenid.com

Several other suggestions to add to mime.types:

text/plain md5 sha1;
archive/xz lzma xz;
binary/tdb-garmin-map tdb;
binary/garmin-style typ;
xml/garmin-track-file gpx;

comment:5 Changed 7 years ago by aitte.myopenid.com

I just discovered that the HTML5 Boilerplate project chose to serve OpenType? with this invalid MIME type: "font/opentype". It's not legal ("font/*" is not a valid mime type), but turns out that this is the ONLY way to avoid console errors in Google Chrome! All other mime types will make Google Chrome log an error saying that a font was served with an invalid mime type. So yeah, they really take care of the tiniest details over there and it would be a very good idea to look at their project for fixes to your mime.types file.

Last edited 7 years ago by aitte.myopenid.com (previous) (diff)

comment:6 Changed 7 years ago by mdounin

  • Keywords mime mime.types added

comment:7 Changed 6 years ago by maxim

  • Owner set to pluknet
  • Status changed from new to assigned

comment:8 Changed 6 years ago by Sergey Kandaurov <pluknet@…>

In 010bb2e21f3f9c47469accbc503aed29d7dc5cae/nginx:

MIME: eot MIME type updated to follow IANA (ticket #306).

comment:9 Changed 6 years ago by pluknet

  • Resolution set to fixed
  • Status changed from assigned to closed

comment:10 Changed 6 years ago by pluknet

.eot and .js were committed some time ago.
Others MIME types are not something to be committed.

Note: See TracTickets for help on using tickets.