(PARTIALLY SOLVED) Nextcloud 21 - JS not loading properly on login page except when using cellular network (Firefox, Chrome)

Nextcloud version : 21.0.0.18
Operating system and version : Ubuntu Server 20.04
Apache or nginx version : 2.4.41
PHP version : 7.4

HTTPS is activated, Let’s Encrypt certificates OK.

My issue :
Hello everyone,
I did an install (not with Docker) of Nextcloud 21 a few days ago on a VPS at Gandi.net.
Guides to do this where mostly those two :
How to Install LAMP Stack on Ubuntu 20.04 Server/Desktop - LinuxBabe
Install NextCloud on Ubuntu 20.04 with Apache (LAMP Stack) - LinuxBabe

Yesterday, I installed DAV apps (calendar, tasks), then Docker and soon after (but it may not be related, since I did some other things on the instance/server) I had this issue : login webpage is loading for a long time, but the login form/fields aren’t displayed.
Nextcloud desktop client (Windows) and Android are working fine. Trying to login with Chromium on the same computer has the same result, trying to login from another computer with Firefox has the same result : no login form displayed.
Strangest thing to me is this : when I use my regular ethernet connection (with a low bandwidth), I have the issue, while I didn’t have it for the last few days, and didn’t change anything to my router etc. ; but when I share my 4G cellular connection with the computer, or when I try to connect directly with my phone (Firefox), the login form is displayed …really frustrating :grimacing:

As side notes :

  • I can see login form normally displayed on this demo page Nextcloud
  • My VPS provider isn’t Cloudflare, nor OVH, so I don’t have any “Rocket Loader” option, or “.ovhconfig” file (php/phpcgi feature) anywhere. Gandi.net doesn’t offer to my knowledge any options like these on VPS.
  • Firefox updated from version 86 to 87 at some point

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

Steps to replicate it:

  1. Launch my https://nextcloud webpage on Firefox/Chromium with any computer on my local network, with my regular ethernet connection
  2. Login web page displays custom background color, logo, favicon, tagline etc., but no login form.
  3. Everything else (desktop and Android clients, apps…) seems to be working fine.

Before posting here, I checked many pages everywhere around and tried things.

What I tried (not in this order) :

  • Ctrl+F5 many times…
  • Disabling Adblock (Firefox add-on)
  • Enabling/Disabling “enable source maps” in developer tools settings
  • Disabling/Enabling Docker sudo systemctl start docker and sudo systemctl stop docker (service and socket)
  • Checking if the fact that my ISP migrated full stack IPv4 to shared IPv4 had an impact
  • Checking my firewall, and UFW on the VPS also
  • Checking memory usage and disk space on the VPS
  • Deleting css and js folders in my nextcloud-data appdata folder and then running sudo -u www-data php /var/www/nextcloud/occ files:scan-app-data
  • With occ I did also files:cleanup, files:scan --all, maintenance:mimetype:update-js
  • Activating intl module and apc.enable_cli = 1 in PHP (php.ini)
  • Adding 'overwritehost' => 'cloud.nomenemo.online' and 'overwriteprotocol' => 'https' to config.php
  • Doing sudo chown www-data:www-data /var/www/nextcloud -R (and on nextcloud-data also), just to be sure…
  • Also tried to configure Redis differently before getting back to the previous config
  • Maybe some other things I saw here and there…

Many thanks to anyone who will provide some help on this issue, I’m really exhausted and don’t know what to do ! And forgive me if I have a bad english, after all I’m french ! :slight_smile:

In Firefox, the <div id=login></div> is empty, and developer tools console gives some errors on JS scripts like :

    Uncaught ReferenceError: OC is not defined
    Uncaught ReferenceError: jQuery is not defined
    Uncaught ReferenceError: Select2 is not defined
    Uncaught ReferenceError: OCA is not defined

The output of my config.php file in /var/www/nextcloud/config/ :

<?php
$CONFIG = array (
  'instanceid' => '***',
  'passwordsalt' => '***',
  'secret' => '***',
  'trusted_domains' =>
  array (
    0 => 'cloud.***.***',
    1 => 'localhost',
  ),
  'datadirectory' => '/var/www/nextcloud-data',
  'dbtype' => 'mysql',
  'version' => '21.0.0.18',
  'overwritehost' => 'cloud.***.***',
  'overwriteprotocol' => 'https',
  'overwrite.cli.url' => 'https://cloud.***.***',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost:3306',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => '***',
  'dbpassword' => '***',
  'installed' => true,
  'debug' => true,
  'memcache.local' => '\OC\Memcache\APCu',
  'memcache.locking' => '\OC\Memcache\Redis',
  'memcache.distributed' => '\OC\Memcache\Redis',
  'redis' =>
  array (
    'host' => '/run/redis/redis-server.sock',
    'port' => 0,
  ),
  'mail_smtpmode' => 'smtp',
  'mail_smtpsecure' => 'ssl',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => '***.***',
  'mail_domain' => '***.***',
  'mail_smtpauthtype' => 'PLAIN',
  'mail_smtpauth' => 1,
  'mail_smtphost' => 'smtp.***.***',
  'mail_smtpport' => '465',
  'mail_smtpname' => '***.***@***.***',
  'mail_smtppassword' => '***',
  'maintenance' => false,
);

The output of my Nextcloud log in Admin > Logging is too big for posting here, so feel free to ask if needed… Same for Apache access logs, etc…

EDIT : As this login page is visible on Firefox Android version 84, I just tried Firefox 84 for Windows, but no luck, it has the same result…

After trying many other tricks/solutions, I resigned myself to only use my Nextcloud instance with my cell phone, I let it run as it was for several days.
One of the last things I tried was to understand the infamous Appstore error (“cURL error 28”, etc.), only to find out what many said in this forum : the Nextcloud team is responsible for this, nothing to do on private instances… Well, OK.
So, I used my Nextcloud with phone connection connected to my pc.
Today, I just forgot to link it, and my login page suddenly displayed. One notification was saying that one app had to be updated : I got to it and witnessed then that the Appstore was up and working again.
Shall I conclude from this that my Nextcloud instance wasn’t working because the official Nextcloud App store was down ? (*)
Anyone thinking like me that it’s not a normal behaviour ?

(*) and of course also because the connection to the Appstore isn’t well managed for low bandwidth networks.

Hi.

I have from time to time without changing anything in NC exactly the same problem.

Nothing helps to bring the login form back…
but installing a backup…

Do I understand it correct…
The problem occurs when the appstore is not reachable?

So I think this problem is still happening to you from time to time?

Any news for a solution… besides a software-fix from nc?.. I am on nc22… so news here :frowning:

Thanks for your help
Bestregards from Germany …
Christian

I was having a very similar issue. For me the problem turned out to be the reverse proxy was acting up.

If I accessed NC directly, inside my network, it all worked fine, but If I accessed it through its domain, that’s when JS resources stopped loading.

I executed the maintenance repair command, and that didn’t help (because the issue was with the reverse proxy).

After I restarted my reverse proxy it all came back to normal. I hope this helps.