From 794f71483ae61dcc1486163d5f1bb4f2121fdd4f Mon Sep 17 00:00:00 2001 From: TheSpad Date: Fri, 22 Dec 2023 17:01:35 +0000 Subject: [PATCH 1/4] Avoid duplicate mime definition --- .../nginx/site-confs/default.conf.sample | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/root/defaults/nginx/site-confs/default.conf.sample b/root/defaults/nginx/site-confs/default.conf.sample index 6b46cec..7fde9ae 100644 --- a/root/defaults/nginx/site-confs/default.conf.sample +++ b/root/defaults/nginx/site-confs/default.conf.sample @@ -59,15 +59,6 @@ server { # Remove X-Powered-By, which is an information leak fastcgi_hide_header X-Powered-By; - # Add .mjs as a file extension for javascript - # Either include it in the default mime.types list - # or include you can include that list explicitly and add the file extension - # only for Nextcloud like below: - include mime.types; - types { - text/javascript js mjs; - } - # Specify how to handle directories -- specifying `/index.php$request_uri` # here as the fallback means that Nginx always exhibits the desired behaviour # when a client requests a path that corresponds to a directory that exists @@ -151,6 +142,14 @@ server { location ~ \.wasm$ { default_type application/wasm; } + location ~ \.js$ { + default_type text/javascript; + } + + location ~ \.mjs$ { + default_type text/javascript; + } + } location ~ \.woff2?$ { From 37eb7522e16f37472a5103459e418e77a073544e Mon Sep 17 00:00:00 2001 From: TheSpad Date: Fri, 22 Dec 2023 17:08:14 +0000 Subject: [PATCH 2/4] Prefer application/javascript --- root/defaults/nginx/site-confs/default.conf.sample | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/root/defaults/nginx/site-confs/default.conf.sample b/root/defaults/nginx/site-confs/default.conf.sample index 7fde9ae..2a85c95 100644 --- a/root/defaults/nginx/site-confs/default.conf.sample +++ b/root/defaults/nginx/site-confs/default.conf.sample @@ -143,11 +143,11 @@ server { default_type application/wasm; } location ~ \.js$ { - default_type text/javascript; + default_type application/javascript; } location ~ \.mjs$ { - default_type text/javascript; + default_type application/javascript; } } From 0ad8c52d56de88c9bb0825f00d3557132fa28e4a Mon Sep 17 00:00:00 2001 From: TheSpad Date: Fri, 22 Dec 2023 17:15:18 +0000 Subject: [PATCH 3/4] Use text/javascript as per rfc9239 --- root/defaults/nginx/site-confs/default.conf.sample | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/root/defaults/nginx/site-confs/default.conf.sample b/root/defaults/nginx/site-confs/default.conf.sample index 2a85c95..7fde9ae 100644 --- a/root/defaults/nginx/site-confs/default.conf.sample +++ b/root/defaults/nginx/site-confs/default.conf.sample @@ -143,11 +143,11 @@ server { default_type application/wasm; } location ~ \.js$ { - default_type application/javascript; + default_type text/javascript; } location ~ \.mjs$ { - default_type application/javascript; + default_type text/javascript; } } From 4178035a55da8d161c6de7c2f4e7c12bb9950f30 Mon Sep 17 00:00:00 2001 From: TheSpad Date: Fri, 22 Dec 2023 17:16:22 +0000 Subject: [PATCH 4/4] Consistent formatting --- root/defaults/nginx/site-confs/default.conf.sample | 1 + 1 file changed, 1 insertion(+) diff --git a/root/defaults/nginx/site-confs/default.conf.sample b/root/defaults/nginx/site-confs/default.conf.sample index 7fde9ae..4ae2a0c 100644 --- a/root/defaults/nginx/site-confs/default.conf.sample +++ b/root/defaults/nginx/site-confs/default.conf.sample @@ -142,6 +142,7 @@ server { location ~ \.wasm$ { default_type application/wasm; } + location ~ \.js$ { default_type text/javascript; }