Skip to content

Change MIME type mapping for JavaScript to text/javascript #33197

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mhankus opened this issue Jul 11, 2024 · 0 comments
Closed

Change MIME type mapping for JavaScript to text/javascript #33197

mhankus opened this issue Jul 11, 2024 · 0 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Milestone

Comments

@mhankus
Copy link

mhankus commented Jul 11, 2024

Currently Spring maps js files to the application/javascript MIME type, as can be seen in mime.types.

According to https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types#textjavascript

Per the IANA Media Types registry, RFC 9239, and the HTML specification, JavaScript content should always be served using the MIME type text/javascript. No other MIME types are considered valid for JavaScript, and using any MIME type other than text/javascript may result in scripts that do not load or run.

You may find some JavaScript content incorrectly served with a charset parameter as part of the MIME type — as an attempt to specify the character set for the script content. That charset parameter isn't valid for JavaScript content, and in most cases will result in a script failing to load.

Please update the mapping, so that JavaScript files are served in compliance with RFC 9239.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jul 11, 2024
@sbrannen sbrannen added the in: web Issues in web modules (web, webmvc, webflux, websocket) label Jul 11, 2024
@sbrannen sbrannen changed the title Incorrect mime for javascript Incorrect MIME type mapping for javascript Jul 11, 2024
@sbrannen sbrannen changed the title Incorrect MIME type mapping for javascript Update MIME type mapping for JavaScript Jul 11, 2024
@sbrannen sbrannen self-assigned this Jul 11, 2024
@sbrannen sbrannen added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Jul 11, 2024
@sbrannen sbrannen added this to the 6.2.0-M6 milestone Jul 11, 2024
@sbrannen sbrannen changed the title Update MIME type mapping for JavaScript Change MIME type mapping for JavaScript to text/javascript Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants