Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 762964 - www-servers/nginx: bundled mime.types file has poor coverage
Summary: www-servers/nginx: bundled mime.types file has poor coverage
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Thomas Deutschmann
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-01 20:07 UTC by Kerin Millar
Modified: 2021-01-05 15:43 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kerin Millar 2021-01-01 20:07:13 UTC
The mime.types file bundled by nginx has poor media type coverage.

# types() { awk '/\// { print $1 }' "$@" | sort -u; }
# types /etc/nginx/mime.types | wc -l
80

Now let's look at the mime.types file provided by app-misc/mime-types.

# types /etc/mime.types | wc -l
1918

That's quite a discrepancy. Of course, total numbers don't tell the whole story. Let's consider which media types appear in /etc/nginx/mime.types that do not appear in /etc/mime.types.

# grep -vxFf <(types /etc/mime.types) <(types /etc/nginx/mime.types) 
application/x-cocoa
application/x-java-archive-diff
application/x-makeself
application/x-perl
application/x-pilot
application/x-sea
audio/x-m4a
font/woff
font/woff2

Of these 9, all appear to be non-standard except for font/woff and font/woff2, per RFC8081. However, this could be addressed by issuing a much-needed update to app-misc/mime-types itself.

In Summary, I think that Gentoo could benefit enormously from adopting the approach of several other distributions, whereby the default nginx config references a set of media types that is standardised and subjected to routine maintenance, rather than the limited set provided by the nginx sources.

To provide but one example, Arch Linux not only provides /etc/mime.types from the upstream mailcap project, but also uses its bundled script to generate an /etc/nginx/mime.types file that is suitable for inclusion by the default /etc/nginx/nginx.conf. Aside from providing better coverage, it allows for the list of media types to be kept in sync with IANA without necessarily having to update nginx itself.

See also, bug 762958.