[PATCH] Correct JavaScript MIME types + extensions per RFC 9239

Maxim Dounin mdounin at mdounin.ru
Thu May 26 23:18:13 UTC 2022


On Mon, May 23, 2022 at 11:32:08AM +0200, Mathias Bynens via nginx-devel wrote:

> Thank you, Maxim. Is there anything else I can do to help move this
> along? The change is rather small and clearly follows the latest RFC,
> so I would expect it to be uncontroversial.

On the other hand, the RFC itself is rather controversial, as it 
changes preferred MIME type for javascript for no apparent reason, 
and it adds the "mjs" extension, which is known to be mostly used 
in NodeJS-specific environments and was originally introduced with 
quite questionable claim that "on the web file extensions doesn't 

I don't think we are in position to add the mjs extension, it does 
not seem to qualify as something commonly used on the web now.  
The ticket referenced in the previous message can be used to track 
the request.

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).

Hope this helps.

Maxim Dounin

More information about the nginx-devel mailing list