[nginx] MIME: use "application/javascript" for .js files.

Valentin Bartenev vbart at nginx.com
Wed Jul 31 19:41:36 UTC 2013


details:   http://hg.nginx.org/nginx/rev/ae3fd1ca62e0
branches:  
changeset: 5311:ae3fd1ca62e0
user:      Valentin Bartenev <vbart at nginx.com>
date:      Wed Jul 31 23:40:46 2013 +0400
description:
MIME: use "application/javascript" for .js files.

Though there are several MIME types commonly used for JavaScript nowadays,
the most common being "text/javascript", "application/javascript", and
currently used by nginx "application/x-javascript", RFC 4329 prefers
"application/javascript".

The "charset_types" directive's default value was adjusted accordingly.

diffstat:

 conf/mime.types                                   |  2 +-
 src/http/modules/ngx_http_charset_filter_module.c |  2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diffs (24 lines):

diff -r fa07bec738ac -r ae3fd1ca62e0 conf/mime.types
--- a/conf/mime.types	Wed Jul 31 18:35:57 2013 +0400
+++ b/conf/mime.types	Wed Jul 31 23:40:46 2013 +0400
@@ -5,7 +5,7 @@ types {
     text/xml                              xml;
     image/gif                             gif;
     image/jpeg                            jpeg jpg;
-    application/x-javascript              js;
+    application/javascript                js;
     application/atom+xml                  atom;
     application/rss+xml                   rss;
 
diff -r fa07bec738ac -r ae3fd1ca62e0 src/http/modules/ngx_http_charset_filter_module.c
--- a/src/http/modules/ngx_http_charset_filter_module.c	Wed Jul 31 18:35:57 2013 +0400
+++ b/src/http/modules/ngx_http_charset_filter_module.c	Wed Jul 31 23:40:46 2013 +0400
@@ -128,7 +128,7 @@ ngx_str_t  ngx_http_charset_default_type
     ngx_string("text/xml"),
     ngx_string("text/plain"),
     ngx_string("text/vnd.wap.wml"),
-    ngx_string("application/x-javascript"),
+    ngx_string("application/javascript"),
     ngx_string("application/rss+xml"),
     ngx_null_string
 };



More information about the nginx-devel mailing list