Skip to content

Correct JavaScript MIME types + extensions per RFC 9239#77

Closed
mathiasbynens wants to merge 1 commit intonginx:masterfrom
mathiasbynens:fix-js-mime-and-extensions
Closed

Correct JavaScript MIME types + extensions per RFC 9239#77
mathiasbynens wants to merge 1 commit intonginx:masterfrom
mathiasbynens:fix-js-mime-and-extensions

Conversation

@mathiasbynens
Copy link
Copy Markdown

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

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
@mathiasbynens
Copy link
Copy Markdown
Author

mathiasbynens commented May 7, 2022

@thresheek
Copy link
Copy Markdown
Member

Hi! Thank you for your contribution.

Pull requests on GitHub are not accepted - unfortunately we have no way of turning them off. The proper way to submit changes to nginx is via the nginx development mailing list, see https://nginx.org/en/docs/contributing_changes.html

@mathiasbynens
Copy link
Copy Markdown
Author

Thank you @thresheek. I’ve sent the patch to the mailing list here: https://mailman.nginx.org/archives/list/nginx-devel@nginx.org/thread/7PN54GRH2S4ESBBTUTGZDXEKPEZGCWOJ/

@laukstein
Copy link
Copy Markdown

text/javascript was approved in httpd. Why isn't yet in nginx?

https://github.com/apache/httpd/blob/ee3449d71e1187ad5432afde6c53418a32ae73ea/CHANGES#L174-L177

  *) core: the conf/mime.types has been updated in conformance with RFC 9239:
     - .js moved from 'application/javascript' to 'text/javascript'
     - .mjs was added as 'text/javascript'
     [Mathias Bynens <@mathiasbynens> via PR 318]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants