linuxserver / docker-nextcloud

GNU General Public License v3.0
678 stars 128 forks source link

[BUG] mjs files get an Content-Type of octet-stream while beeing a javascript file #388

Closed krombel closed 6 months ago

krombel commented 6 months ago

Is there an existing issue for this?

Current Behavior

request of logging.mjs fails as content type is octet-stream (which browser refuses to handle as javascript file)

Expected Behavior

mjs file has the correct content type of text/javascript

Steps To Reproduce

Setup nextcloud with the current image (nextcloud version 28) and access the logging tab.

This is AFAIK the first occurrence of such files yet

Environment

No response

CPU architecture

x86-64

Docker creation

docker compose up (as documented in README)

Container logs

not relevant

Hint: Official documentation got changed so it includes now the following snippet(commit):

    types {
        text/javascript js mjs;
    }
github-actions[bot] commented 6 months ago

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

farhills commented 6 months ago

Same issue. I'll add the link to the Nextcloud/logging issue and specific comment for added context: https://github.com/nextcloud/logreader/issues/1073 https://github.com/nextcloud/logreader/issues/1073#issuecomment-1855910287

j0nnymoe commented 6 months ago

It's an upstream issue. Out of our control.

Ziyann commented 6 months ago

It's not an upstream issue. We need to add it to our nginx config, as seen here: https://docs.nextcloud.com/server/latest/admin_manual/installation/nginx.html

    # 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;
    }
Nevarro commented 6 months ago

It's not an upstream issue. We need to add it to our nginx config, as seen here: https://docs.nextcloud.com/server/latest/admin_manual/installation/nginx.html

    # 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;
    }

I added this in my Nginx Proxy Manager for my Nextcloud-Domain, though logging is still empty.

thespad commented 6 months ago

Fixed by #392 (and #393).

For existing installs you'll need to either update the confs directly, or copy the new sample over your existing live conf after updating to the newly-bulit image.

cravas commented 6 months ago

After the updated "site-confs/default.conf", I get this: nginx: [warn] duplicate extension "js", content type: "text/javascript", previous content type: "application/javascript" in /config/nginx/site-confs/default.conf:68

IIRC, this happens due to /etc/nginx.mime.types already has a line with it mentioned:

pi@xxxxxxxxx:~ $ docker exec -it nextcloud bash

root@830c900ff643:/# ls -al /etc/nginx/mime.types
-rw-r--r-- 1 root root 5349 Oct 15 22:12 /etc/nginx/mime.types

root@830c900ff643:/# cat /etc/nginx/mime.types | grep js
    application/javascript                           js;

Since that file isn't owned by the PUID that launches the container, it will be recreated as is, even if edited.

Any thoughts on how to clear it?

thespad commented 6 months ago

Yeah we missed it in our testing, we've just kicked off a new build that should fix it if you update your conf again.

cravas commented 6 months ago

Yeah we missed it in our testing, we've just kicked off a new build that should fix it if you update your conf again.

Sorry to say but it broke more than it fixed. Had to revert image to ls291, nginx.conf && site-confs/default.conf to those versions. When on login page, showed "Log in to {ProductInfo}" After login, Weather Info was erroring. Avatar disappeared. Apps showed nothing No side menu apps showing And more that I didn't dig much.

Sorry for no screenshots but if needed, I can redo it again now that I know how to go back. This is my production server and need it always functional.