Skip to content
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

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

Closed
1 task done
krombel opened this issue Dec 15, 2023 · 9 comments
Closed
1 task done

Comments

@krombel
Copy link

krombel commented Dec 15, 2023

Is there an existing issue for this?

  • I have searched the existing issues

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;
    }
Copy link

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

@farhills
Copy link

Same issue. I'll add the link to the Nextcloud/logging issue and specific comment for added context:
nextcloud/logreader#1073
nextcloud/logreader#1073 (comment)

@j0nnymoe
Copy link
Member

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

@Ziyann
Copy link

Ziyann commented Dec 18, 2023

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
Copy link

Nevarro commented Dec 22, 2023

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
Copy link
Member

thespad commented Dec 22, 2023

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.

@thespad thespad closed this as completed Dec 22, 2023
@cravas
Copy link

cravas commented Dec 22, 2023

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
Copy link
Member

thespad commented Dec 22, 2023

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
Copy link

cravas commented Dec 23, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

7 participants