Nextcloud AIO - Could not check for JavaScript support. Please check manually if your webserver serves `.mjs` files using the JavaScript MIME type

I know there are a number of posts with this title, but nothing seems to solve the problem for my setup.

I am running Nextcloud AIO on an Ubuntu server that is behind HAProxy running on Pfsense.

As suggested in other posts, I have tried running:

$ curl -I http://localhost/apps/settings/js/esm-test.mjs
HTTP/1.1 301 Moved Permanently
Location: https://localhost/apps/settings/js/esm-test.mjs
Server: Caddy
Date: Tue, 16 Apr 2024 15:51:02 GMT

and

$ curl -I https://localhost/apps/settings/js/esm-test.mjs
curl: (7) Failed to connect to localhost port 443 after 0 ms: Couldn't connect to server

It seems there is an https issue, but I don’t know how to resolve this. It looks like this started around a week ago.

Any help appreciated. TIA

Try using your public hostname for the cURL, which is also presumably in your trusted_domains already.

And make sure you’re doing the cURL query from within the Nextcloud app container since that’s where the real check runs.

This is the response I get when running the curl command within the Nextcloud container and using my public domain.

HTTP/1.1 200 OK
accept-ranges: bytes
cache-control: max-age=15778463
content-length: 109
content-type: text/javascript
date: Tue, 16 Apr 2024 19:12:42 GMT
etag: “6d-61550bc199704”
last-modified: Fri, 05 Apr 2024 03:05:57 GMT
referrer-policy: no-referrer
strict-transport-security: max-age=31536000;
vary: Accept-Encoding
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-permitted-cross-domain-policies: none
x-robots-tag: noindex, nofollow
x-xss-protection: 1; mode=block

So how come it’s failing the check and throwing up the “Could not check for JavaScript support. Please check manually if your webserver serves .mjs files using the JavaScript MIME type.” error in the Administration>Overview?

1 Like

I have the same problem.

1 Like

@szaimen You have been able to help countless times before. Do you have any idea on how to resolve this issue? I say issue, it doesn’t seem to actually be affecting by Nextcloud from operating, it’s just reporting this error.

Is it a bug?

Check if any of the docker containers have updates for them. AIO uses Apache 2 as a webserver, so I can’t speak specifically to that, since I use nginx running on bare metal.
I needed to add a line to my nginx mime types file in /etc/nginx/mime.types:
application/javascript js;
application/javascript mjs;

I can only assume that in the apache container there is a similar config file, where mjs has to be added. Either by the AIO-Maintainers or manually by you.

This doesn’t directly solve your issue, but should give you information on what to search for and how to solve it. Fingers crossed!

@canisdata I will have a look and see what I can find. It seems funny that no one from support can offer any advice on this. It seems to be a widespread problem experienced by many users. For me, at least, it only appeared recently.

Just to chime in here: i cannot reproduce the issue on my AIO test instance

I seem to have lots of ConnectionExpception cURL error 7: entries in my logs. Is this connected to the mjs issue?

ConnectException cURL error 7: Failed to connect to <MYDOMAIN>.com port 443 after 0 ms

Most likely yes

Amazing. Do you have any suggestions on how to diagnose this?

TIA

Apparently the container cannot reach the configured domain which is most likely caused by your infrastructure. You might want to set up your own local dns server like a pi-hole and overwrite the dns record for your domain to point at the private ip-address of AIO or a reverse proxy in front of it. There are many guides out there how to achieve that, e.g. GitHub - nextcloud/all-in-one: 📦 The official Nextcloud installation method. Provides easy deployment and maintenance with most features included in this one Nextcloud instance.

1 Like

Not sure what you mean by “from support”. This is a community forum and everyone here is volunteering to help others for free.

There are a lot of posts about this topic - many with answers - because it’s a legitimate check to detect a problem.

The vast majority of the occurrences where this warning pops up are local environment matters - generally internal DNS or outbound firewall situations.

You posted output saying you tried from the container and it worked, but the error from your log suggests that isn’t the case. Did you test with https? That’s what needs to work.

Is the https interface on HAProxy via pfsense perhaps not reachable within your network (or, at the very least, not from the Docker network you have AIO on)? If so, that’s what needs to be fixed. Either via the approach suggested by @szaimen or by making the HAProxy external https interface (what your Nextcloud hostname is presumably pointed at), reachable from within your network (which would need to be addressed at the pfsense and/or HAProxy level).

P.S. This isn’t the check saying .mjs handling is failing; this is the check itself for that handling not even being able to execute because of a local environment matter.

1 Like

Sorry if I caused offence. Posting in forums like this is fairly new to me. I appreciate all the help I have received so far, so again, I apologise.

I ran the cURL command again

$ sudo docker exec -it 89eaefea1122 /bin/bash
d14e13a7c51a:/var/www/docker-aio# curl -I https://nextcloud.<MYDOMAIN>.com/apps/settings/js/esm-test.mjs
HTTP/1.1 200 OK
accept-ranges: bytes
cache-control: max-age=15778463
content-length: 109
content-type: text/javascript
date: Thu, 18 Apr 2024 19:37:16 GMT
etag: "6d-61550bc199704"
last-modified: Fri, 05 Apr 2024 03:05:57 GMT
referrer-policy: no-referrer
strict-transport-security: max-age=31536000;
vary: Accept-Encoding
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-permitted-cross-domain-policies: none
x-robots-tag: noindex, nofollow
x-xss-protection: 1; mode=block

d14e13a7c51a:/var/www/docker-aio# 

Am I running it from the wrong container?

Probably yes. You need to run it inside the nextcloud-aio-nextcloud container