Opened 5 years ago

Last modified 5 weeks ago

#1407 reopened enhancement

Should application/javascript be text/javascript in mime.types

Reported by:… Owned by:
Priority: minor Milestone:
Component: other Version: 1.13.x
Keywords: Cc:
uname -a: Linux ip
nginx -V: nginx version: nginx/1.12.1


I think the 'content-type' header for js files should have media type 'text/javascript' (not 'application/javascript')

nginx version: nginx/1.12.1

Change History (4)

comment:1 by Valentin V. Bartenev, 5 years ago

Resolution: invalid
Status: newclosed

Why do you think so?

According to RFC 4329 (April 2006):

Use of the "text" top-level type for this kind of content is known to
be problematic. This document thus defines text/javascript and text/
ecmascript but marks them as "obsolete". Use of experimental and
unregistered media types, as listed in part above, is discouraged.
The media types,

  • application/javascript
  • application/ecmascript

which are also defined in this document, are intended for common use
and should be used instead.

comment:2 by sideshowbarker@…, 5 years ago

Why do you think so?


This document proposes updates to the ECMAScript media types,
superseding the existing registrations for "application/javascript"
and "text/javascript"

In particular see:

And see also

Servers should use text/javascript for JavaScript resources. Servers should not use other JavaScript MIME types for JavaScript resources, and must not use non-JavaScript MIME types.

comment:3 by JakubJanowski@…, 5 weeks ago

Resolution: invalid
Status: closedreopened

RFC 4329 has now been obsoleted by RFC 9239 which states in section 6.1.1 that application/javascript mime type has been deprecated and text/javascript should be used.

comment:4 by Maxim Dounin, 5 weeks ago

Type: defectenhancement

See also ticket #2216 and this thread:

Some quotes from the thread:

As for the MIME type change from "application/javascript" to 
"text/javascript", this is something we'll consider as the outcome 
of the change suggested by the RFC becomes more clear.  For now, 
it looks like this might need more compatibility shims (such 
as adding both "text/javascript" and "application/javascript" to 
the default list of types handled by the charset module) and more 
changes (such as change of the MIME type used by autoindex with 
JSONP format).
In this particular case, the RFC itself talks about "text/*" being 
an incorrect, and only used because "the industry widely adopted 
text/* anyway".  On the other hand, data suggests 
that "application/javascript" is more popular now than 


  COUNT(distinct pageid) total_pages,
  COUNT(0) total_requests
  total_requests DESC


Row	mimeType	total_pages	total_requests	
1	application/javascript 5346744 95187099
2	image/jpeg 4608713 78732193
3	image/png 5129850 58321805
4	text/css 5546313 56797104
5	text/html 5718485 41375375
6	text/javascript 4670822 36042510
11	application/json 3641048 16939555
12	application/x-javascript 2577400 14903323

From the rationale provided in the RFC it is not clear why 
"application/javascript", which is more popular, was dropped in 
favor of the "text/javascript", which is incorrect and less 

Overall, this is something to consider as the outcome of the change suggested by the RFC becomes more clear.

Note: See TracTickets for help on using tickets.