Join the community today
Become a Member

Nginx MIME type for JS

Discussion in 'Install & Upgrades or Pre-Install Questions' started by BobbyWibowo, Dec 11, 2018.

  1. BobbyWibowo

    BobbyWibowo Active Member

    197
    42
    28
    Jul 30, 2015
    Indonesia
    Ratings:
    +71
    Local Time:
    1:57 AM
    1.17.x
    10.3.x
    I'm not sure if you're aware of this. It seems servers are supposed to use text/javascript as opposed to other MIME types (including application/javascript) for JS files, while our default in mime.types appear to be using application/javascript. Though of course, it still works, but still, "standard", kek.

    EDIT: Could it be Cloudflare is forcefully rewriting this to application/javascript? I edited my mime.types and restarted nginx, but my JS files are still using application/javascript, even after purging Cloudflare's cache.

     
    Last edited: Dec 11, 2018
  2. eva2000

    eva2000 Administrator Staff Member

    59,282
    12,508
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,140
    Local Time:
    4:57 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    wrong way round as text/javascript is obsolete in HTML5 specs RFC 4329 - Scripting Media Types. Correct usage is with application/javascript