Where can I find a list of textual MIME types?

2019-05-10 15:28发布

I want to make a list of MIME Types which can be compressed by gzip. The first obvious ones to includes are those which begin with "text/". Beyond that I can only add the ones off the top of my head which I know are textual, like "application/json".

Is there a list, canonical or otherwise, that I can refer to?

4条回答
仙女界的扛把子
2楼-- · 2019-05-10 15:46

Maybe better is to make a list of types to not try to compress with gzip. Those would be the types that you know are already compressed. In particular, image, video, and audio types.

It is better to be inclusive than exclusive, since compressing something already compressed only impacts CPU time on the server, and has a vanishingly small effect on bandwidth. On the other hand not compressing something that can be compressed could have a big effect on bandwidth and therefore user experience. Many types could be added that aren't on your list. You'll totally miss the benefit of compressing those with a whitelist. Better to compress what you don't know about, and only not compress what you know for sure is already compressed.

查看更多
叼着烟拽天下
3楼-- · 2019-05-10 15:50

If you're here looking for a list to put in your gzip_types for Nginx, this is a good starting point (taken from a quick scan of obviously compressable types from /etc/nginx/mime.types):

gzip_types text/css text/xml application/javascript application/atom+xml application/rss+xml text/mathml text/plain text/x-component image/svg+xml application/json application/vnd.google-earth.kml+xml application/x-perl application/xhtml+xml application/xspf+xml;

(text/html is always included, and should not be duplicated in gzip_types)

查看更多
一纸荒年 Trace。
4楼-- · 2019-05-10 15:54

IANA manages the official list of Media Types

But to know which ones are textual, you'd need to consult RFCs in which they were proposed.

查看更多
登录 后发表回答