<div dir="ltr"># HG changeset patch<br># User Mathias Bynens <<a href="mailto:mathias@qiwi.be">mathias@qiwi.be</a>><br># Date 1652088302 -7200<br>#      Mon May 09 11:25:02 2022 +0200<br># Branch fix-js-mime-and-extensions<br># Node ID 7944657540c64d92a5bdc3932710c977d984b54d<br># Parent  35afae4b3dffff6718c0cab3ceb16b9de207c20a<br>Correct JavaScript MIME types + extensions per RFC 9239<br><br>This patch updates the MIME type configuration per RFC 9239.<br><a href="https://www.rfc-editor.org/rfc/rfc9239">https://www.rfc-editor.org/rfc/rfc9239</a><br><br>First, the recommended MIME type is now `text/javascript`:<br><br>> The most widely supported media type in use is `text/javascript`; all<br>> others are considered historical and obsolete aliases of `text/javascript`.<br><br>Second, the `.mjs` extension is now explicitly registered:<br><br>> The `.mjs` file extension signals that the file represents a JavaScript<br>> module. Execution environments that rely on file extensions to<br>> determine how to process inputs parse `.mjs` files using the Module<br>> grammar of [ECMA-262].<br><br>IANA template: <a href="https://www.iana.org/assignments/media-types/text/javascript">https://www.iana.org/assignments/media-types/text/javascript</a><br><br>diff -r 35afae4b3dff -r 7944657540c6 conf/mime.types<br>--- a/conf/mime.types       Fri Apr 29 17:38:01 2022 +0400<br>+++ b/conf/mime.types   Mon May 09 11:25:02 2022 +0200<br>@@ -5,7 +5,7 @@<br>     text/xml                                         xml;<br>     image/gif                                        gif;<br>     image/jpeg                                       jpeg jpg;<br>-    application/javascript                           js;<br>+    text/javascript                                  js mjs;<br>     application/atom+xml                             atom;<br>     application/rss+xml                              rss;<br> <br>diff -r 35afae4b3dff -r 7944657540c6 src/http/modules/ngx_http_charset_filter_module.c<br>--- a/src/http/modules/ngx_http_charset_filter_module.c       Fri Apr 29 17:38:01 2022 +0400<br>+++ b/src/http/modules/ngx_http_charset_filter_module.c Mon May 09 11:25:02 2022 +0200<br>@@ -128,7 +128,7 @@<br>     ngx_string("text/xml"),<br>     ngx_string("text/plain"),<br>     ngx_string("text/vnd.wap.wml"),<br>-    ngx_string("application/javascript"),<br>+    ngx_string("text/javascript"),<br>     ngx_string("application/rss+xml"),<br>     ngx_null_string<br> };<br></div>