How to make apache serve .js.map

Nextcloud version (eg, 29.0.5): 29.0.5
Operating system and version (eg, Ubuntu 24.04): Debian 12 2024-06-01
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.61
PHP version (eg, 8.3): 8.1.29

The issue you are facing:

Setup check error:
Your webserver is not set up to serve.js.map files. Without these files, JavaScript Source Maps won't function properly, making it more challenging to troubleshoot and debug any issues that may arise.

I also did not find in the documentation or Upgrade to Nextcloud 28 — Nextcloud latest Administration Manual latest documentation how to add .js.map to Apache.

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. Just check the Security and setup warnings on NC29.

The output of your Nextcloud log in Admin > Logging:

Nothing relevant.

The output of your Apache/nginx/system log in /var/log/____:

Nothing relevant.

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

Nothing relevant.

Do you have any other warnings or errors?

With Apache you shouldn’t need to do anything. What happens when you run the following from your Nextcloud Server?

curl -I https://domain.tld/apps/settings/js/map-test.js.map

Do you get a 200 or a 404?

1 Like

I get 200:

/**

  • This is a dummy file for testing webserver support of JavaScript map files.
    */
    {}

Currently I have a lot of warnings:

    Could not check that the data directory is protected. Please check manually that your server does not allow access to the data directory. To allow this check to run you have to make sure that your webserver can connect to itself. Therefor it must be able to resolve and connect to at least one its `trusted_domains` or the `overwrite.cli.url`.
    Your webserver is not set up to serve `.js.map` files. Without these files, JavaScript Source Maps won't function properly, making it more challenging to troubleshoot and debug any issues that may arise.
    Could not check for JavaScript support via any of your `trusted_domains` nor `overwrite.cli.url`. This may be the result of a server-side DNS mismatch or outbound firewall rule. Please check manually if your webserver serves `.mjs` files using the JavaScript MIME type. To allow this check to run you have to make sure that your webserver can connect to itself. Therefor it must be able to resolve and connect to at least one its `trusted_domains` or the `overwrite.cli.url`.
    Could not check if your web server properly resolves the OCM and OCS provider URLs. To allow this check to run you have to make sure that your webserver can connect to itself. Therefor it must be able to resolve and connect to at least one its `trusted_domains` or the `overwrite.cli.url`.
    15 errors in the logs since August 27, 2024, 5:44:17 PM

    Could not check that your web server is properly set up to allow file synchronization over WebDAV. Please check manually. To allow this check to run you have to make sure that your webserver can connect to itself. Therefor it must be able to resolve and connect to at least one its `trusted_domains` or the `overwrite.cli.url`. For more details see the documentation ↗.
    Could not check that your web server serves `.well-known` correctly. Please check manually. To allow this check to run you have to make sure that your webserver can connect to itself. Therefor it must be able to resolve and connect to at least one its `trusted_domains` or the `overwrite.cli.url`. For more details see the documentation ↗.
    Could not check for WOFF2 loading support. Please check manually if your webserver serves `.woff2` files. To allow this check to run you have to make sure that your webserver can connect to itself. Therefor it must be able to resolve and connect to at least one its `trusted_domains` or the `overwrite.cli.url`. For more details see the documentation ↗.
    Could not check that your web server serves security headers correctly. Please check manually. For more details see the documentation ↗.

Actually I created another thread for it, but got nowhere yet.

Ah, okay now it makes more sense. These checks are failing due to the reasons mentioned in the docs you linked to. These are related problems. Please check those various mentioned settings/parameters in your environment:
https://docs.nextcloud.com/server/latest/admin_manual/release_notes/upgrade_to_28.html#setup-checks

I basically checked everything looks fine and I had no warnings on NC 28. Then I replied to you in that thread:

“Based on this notes I discovered that my nextcloud instance is not able to wget or curl its own domain. But it always worked without that, so now we need to loosen the security of our instance opening firewall rules to have security checks? It sounds a bit bad…”

I checked basically all mentioned parameters in the documentation and found nothing wrong. Do you have any idea?

1 Like

My apache log showed that Nextcloud was trying to go to // for some items.

With me it turns out I had:
‘overwrite.cli.url’ => ‘https:///’,

It seems this should not contain the / part:
‘overwrite.cli.url’ => ‘https://’,

This resolved the issues regarding javascript maps and the heartbeat errors I was getting.

wait, my config is different:

'trusted_domains' =>
  array (
    0 => 'www.my-domain.tld',
  )
'overwrite.cli.url' => 'https://www.my-domain.tld/sub-folder',
'overwritehost' => 'my-domain.tld',
'overwriteprotocol' => 'https',

your 'overwrite.cli.url' looks more to me like the value expected fo the overwriteprotocol (although I’m surprised to see the :// part included there…

Hi, I faced a similar warning message today when I updated to 29.0.7, and reached this thread.

In my environment, I’m running a reverse proxy for https and my nextcloud server is running http only. I was able to resolve the warnings by modifying /etc/hosts to refer the reverse proxy. Maybe you can solve the issue as well if you have similar env.

Similar situation after upgrading to NC29, i was faced with a couple of errors:

  • Could not check that the data directory is protected. Please check manually that your server does not allow access to the data directory. To allow this check to run you have to make sure that your webserver can connect to itself. Therefor it must be able to resolve and connect to at least one its trusted_domains or the overwrite.cli.url.
  • Your webserver is not set up to serve .js.map files. Without these files, JavaScript Source Maps won’t function properly, making it more challenging to troubleshoot and debug any issues that may arise.
  • Could not check for JavaScript support via any of your trusted_domains nor overwrite.cli.url. This may be the result of a server-side DNS mismatch or outbound firewall rule. Please check manually if your webserver serves .mjs files using the JavaScript MIME type. To allow this check to run you have to make sure that your webserver can connect to itself. Therefor it must be able to resolve and connect to at least one its trusted_domains or the overwrite.cli.url.
  • Could not check if your web server properly resolves the OCM and OCS provider URLs. To allow this check to run you have to make sure that your webserver can connect to itself. Therefor it must be able to resolve and connect to at least one its trusted_domains or the overwrite.cli.url.
  • 12 errors in the logs since August 19, 2024, 3:09:13 PM
  • Could not check that your web server is properly set up to allow file synchronization over WebDAV. Please check manually. To allow this check to run you have to make sure that your webserver can connect to itself. Therefor it must be able to resolve and connect to at least one its trusted_domains or the overwrite.cli.url. For more details see the documentation :arrow_upper_right:.
  • Could not check that your web server serves .well-known correctly. Please check manually. To allow this check to run you have to make sure that your webserver can connect to itself. Therefor it must be able to resolve and connect to at least one its trusted_domains or the overwrite.cli.url. For more details see the documentation :arrow_upper_right:.
  • Could not check for WOFF2 loading support. Please check manually if your webserver serves .woff2 files. To allow this check to run you have to make sure that your webserver can connect to itself. Therefor it must be able to resolve and connect to at least one its trusted_domains or the overwrite.cli.url. For more details see the documentation :arrow_upper_right:.
  • Could not check that your web server serves security headers correctly. Please check manually. For more details see the documentation :arrow_upper_right:.

It seems something doesn’t work correct when using subfolders, at least in my case some requests are made to domain/nextcloud/, while others are made to domain/nextcloud/nextcloud/

127.0.0.1 - - [16/Sep/2024:17:36:51 +0200] “HEAD /nextcloud/nextcloud/data/.ocdata HTTP/1.1” 404 2048 “-” “Nextcloud Server Crawler”
127.0.0.1 - - [16/Sep/2024:17:36:51 +0200] “HEAD /nextcloud/nextcloud/data/.ocdata HTTP/1.1” 404 6073 “-” “Nextcloud Server Crawler”
127.0.0.1 - - [16/Sep/2024:17:36:52 +0200] “HEAD /nextcloud/nextcloud/apps/settings/js/map-test.js.map HTTP/1.1” 404 2046 “-” “Nextcloud Server Crawler”
127.0.0.1 - - [16/Sep/2024:17:36:52 +0200] “HEAD /nextcloud/nextcloud/apps/settings/js/map-test.js.map HTTP/1.1” 404 6075 “-” “Nextcloud Server Crawler”
127.0.0.1 - - [16/Sep/2024:17:36:52 +0200] “HEAD /nextcloud/nextcloud/apps/settings/js/esm-test.mjs HTTP/1.1” 404 2050 “-” “Nextcloud Server Crawler”
127.0.0.1 - - [16/Sep/2024:17:36:52 +0200] “HEAD /nextcloud/nextcloud/apps/settings/js/esm-test.mjs HTTP/1.1” 404 6073 “-” “Nextcloud Server Crawler”
127.0.0.1 - - [16/Sep/2024:17:36:53 +0200] “HEAD /nextcloud/ocm-provider/ HTTP/1.1” 200 1427 “-” “Nextcloud Server Crawler”
127.0.0.1 - - [16/Sep/2024:17:36:53 +0200] “HEAD /nextcloud/ocs-provider/ HTTP/1.1” 200 1396 “-” “Nextcloud Server Crawler”
127.0.0.1 - - [16/Sep/2024:17:36:53 +0200] “GET /nextcloud/nextcloud/index.php/heartbeat HTTP/1.1” 404 6776 “-” “Nextcloud Server Crawler”
127.0.0.1 - - [16/Sep/2024:17:36:53 +0200] “GET /nextcloud/nextcloud/index.php/heartbeat HTTP/1.1” 404 10799 “-” “Nextcloud Server Crawler”
127.0.0.1 - - [16/Sep/2024:17:36:53 +0200] “HEAD /nextcloud/nextcloud/core/fonts/NotoSans-Regular-latin.woff2 HTTP/1.1” 404 2046 “-” “Nextcloud Server Crawler”
127.0.0.1 - - [16/Sep/2024:17:36:53 +0200] “HEAD /nextcloud/nextcloud/core/fonts/NotoSans-Regular-latin.woff2 HTTP/1.1” 404 6073 “-” “Nextcloud Server Crawler”

i ended up adding a redirect rule to my .htaccess file:

Redirect “/nextcloud/nextcloud” “/nextcloud”

I’m certain there are better ways to fix this but it’s well enough for my personal needs.

1 Like

@etence which are your modifications in etc/hosts. I‘m using a reverse proxy like yours also.

In my case, there are relevant 2 servers as follows:

  • Server A, 192.168.100.1 (reverse.example[.]com): Reverse proxy listening https to forward to internal servers with http
  • Server B, 192.168.100.2 (nextcloud.example[.]com): Nextcloud with http

I modified /etc/hosts in Server B as follows:

# 192.168.100.2 nextcloud.example[.]com nextcloud
192.168.100.1 nextcloud.example[.]com nextcloud

This change has been working in my environment.

1 Like

You are my man. It works. :+1:

1 Like