Welcome! Log In Create A New Profile

Advanced

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

Mathias Bynens via nginx-devel
May 09, 2022 05:50AM
# HG changeset patch
# User Mathias Bynens <mathias@qiwi.be>
# Date 1652088302 -7200
# Mon May 09 11:25:02 2022 +0200
# Branch fix-js-mime-and-extensions
# Node ID 7944657540c64d92a5bdc3932710c977d984b54d
# Parent 35afae4b3dffff6718c0cab3ceb16b9de207c20a
Correct JavaScript MIME types + extensions per RFC 9239

This patch updates the MIME type configuration per RFC 9239.
https://www.rfc-editor.org/rfc/rfc9239

First, the recommended MIME type is now `text/javascript`:

> The most widely supported media type in use is `text/javascript`; all
> others are considered historical and obsolete aliases of
`text/javascript`.

Second, the `.mjs` extension is now explicitly registered:

> The `.mjs` file extension signals that the file represents a JavaScript
> module. Execution environments that rely on file extensions to
> determine how to process inputs parse `.mjs` files using the Module
> grammar of [ECMA-262].

IANA template: https://www.iana.org/assignments/media-types/text/javascript

diff -r 35afae4b3dff -r 7944657540c6 conf/mime.types
--- a/conf/mime.types Fri Apr 29 17:38:01 2022 +0400
+++ b/conf/mime.types Mon May 09 11:25:02 2022 +0200
@@ -5,7 +5,7 @@
text/xml xml;
image/gif gif;
image/jpeg jpeg jpg;
- application/javascript js;
+ text/javascript js mjs;
application/atom+xml atom;
application/rss+xml rss;

diff -r 35afae4b3dff -r 7944657540c6
src/http/modules/ngx_http_charset_filter_module.c
--- a/src/http/modules/ngx_http_charset_filter_module.c Fri Apr 29 17:38:01
2022 +0400
+++ b/src/http/modules/ngx_http_charset_filter_module.c Mon May 09 11:25:02
2022 +0200
@@ -128,7 +128,7 @@
ngx_string("text/xml"),
ngx_string("text/plain"),
ngx_string("text/vnd.wap.wml"),
- ngx_string("application/javascript"),
+ ngx_string("text/javascript"),
ngx_string("application/rss+xml"),
ngx_null_string
};
_______________________________________________
nginx-devel mailing list -- nginx-devel@nginx.org
To unsubscribe send an email to nginx-devel-leave@nginx.org
Subject Author Views Posted

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

Mathias Bynens via nginx-devel 164 May 09, 2022 05:50AM

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

Maxim Dounin 29 May 09, 2022 02:28PM

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

Mathias Bynens via nginx-devel 7 May 23, 2022 05:34AM

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

Mathias Bynens via nginx-devel 2 May 25, 2022 03:26AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 132
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready