From bf3c76a5f8040a1fc5951511e0269ad4c23ac52e Mon Sep 17 00:00:00 2001
From: hoellen <dev@hoellen.eu>
Date: Tue, 2 Jan 2024 10:23:42 +0100
Subject: [PATCH] chore: update nginx configuration

 - update static file extensions
 - add mjs to mimetype
   https://github.com/hoellen/docker-nextcloud/issues/60
 - remove legacy header
   https://github.com/hoellen/docker-nextcloud/pull/61
---
 rootfs/etc/nginx/conf.d/default.conf | 3 +--
 rootfs/etc/nginx/nginx.conf          | 5 +++++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/rootfs/etc/nginx/conf.d/default.conf b/rootfs/etc/nginx/conf.d/default.conf
index 8ef6242..0e0928f 100644
--- a/rootfs/etc/nginx/conf.d/default.conf
+++ b/rootfs/etc/nginx/conf.d/default.conf
@@ -18,7 +18,6 @@ server {
 
         add_header Referrer-Policy "no-referrer" always;
         add_header X-Content-Type-Options "nosniff" always;
-        add_header X-Download-Options "noopen" always;
         add_header X-Frame-Options "SAMEORIGIN" always;
         add_header X-Permitted-Cross-Domain-Policies "none" always;
         add_header X-Robots-Tag "noindex, nofollow" always;
@@ -67,7 +66,7 @@ server {
             index index.php;
         }
 
-        location ~ \.(?:css|js|svg|gif|map)$ {
+        location ~ \.(?:css|js|mjs|svg|gif|png|jpg|ico|wasm|tflite|map|ogg|flac)$ {
             try_files $uri /index.php$uri$is_args$args;
             expires 6M;
             access_log off;
diff --git a/rootfs/etc/nginx/nginx.conf b/rootfs/etc/nginx/nginx.conf
index 6d32196..a79034b 100644
--- a/rootfs/etc/nginx/nginx.conf
+++ b/rootfs/etc/nginx/nginx.conf
@@ -9,6 +9,11 @@ events {
 
 http {
     include /etc/nginx/mime.types;
+    # Add .mjs as a file extension for javascript
+    # https://github.com/nextcloud/server/pull/36057
+    types {
+        application/javascript mjs;
+    }
     default_type  application/octet-stream;
 
     access_log /nginx/logs/access.log combined;