Web interface is slow, loading time up to 55 s due to JS assets

Nextcloud version: 21.0.0
Operating system and version: Ubuntu Server 20.10

Using docker image (latest): Docker Hub
Apache or nginx version: Apache/2.4.38 (Debian)
PHP version: 7.4.16
I am using reverse nginx proxy with Let’s encrypt: GitHub - nginx-proxy/acme-companion: Automated ACME SSL certificate generation for nginx-proxy

The issue you are facing:

Web interface loads very slowly due to long downloading times of JS assets (up to 50s, see the screenshot). When the JS assets are locally cached, then the load of the web interface is fast, but the cache is invalidated often.

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

Steps to replicate it:

  1. Install Nextcloud according to the manual: Docker Hub
  2. Go to Nextcloud interface

2021-04-03_04-14

This is my docker-compose:

version: '2'

volumes:
  nextcloud:
  db:
  proxy_vhosts:
  proxy_certs:
  proxy_html:

services:
  db:
    image: mariadb
    restart: always
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    volumes:
      - db:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=******
      - MYSQL_PASSWORD=******
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud

  app:
    image: nextcloud
    restart: always
    links:
      - db
    volumes:
      - /var/www/html/nextcloud:/var/www/html
    environment:
      - MYSQL_PASSWORD=******
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_HOST=db
      - VIRTUAL_HOST=mydomain.cz
      - LETSENCRYPT_HOST=mydomain.cz
      - NEXTCLOUD_TRUSTED_DOMAINS='mydomain.cz'
    container_name: nextcloud

  nginx-proxy:
    image: jwilder/nginx-proxy
    ports:
      - 80:80
      - 443:443
    volumes:
      - proxy_certs:/etc/nginx/certs
      - proxy_vhosts:/etc/nginx/vhost.d
      - proxy_html:/usr/share/nginx/html
      - /var/run/docker.sock:/tmp/docker.sock:ro
      - /home/sitnarf/projects/nextcloud-setup/nginx-size-limit.conf:/etc/nginx/conf.d/my_proxy.conf:ro

  letsencrypt-nginx-proxy:
    image: jrcs/letsencrypt-nginx-proxy-companion
    volumes_from:
      - nginx-proxy:rw

    volumes:
      - /etc/acme.sh
      - /var/run/docker.sock:/var/run/docker.sock:ro

The output of your Nextcloud log in Admin > Logging:

{"reqId":"7Ll2S1KkBQNgce25dVVu","level":2,"time":"2021-04-03T10:02:22+00:00","remoteAddr":"89.221.214.191","user":"sitnarf","app":"no app in context","method":"GET","url":"/apps/files/","message":"Invalid data provided to provideInitialState by files","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36","version":"21.0.0.18"}
{"reqId":"sdkQViQ3E9MJbK8RIB5o","level":2,"time":"2021-04-03T10:02:23+00:00","remoteAddr":"89.221.214.191","user":"sitnarf","app":"no app in context","method":"GET","url":"/apps/files/","message":"Invalid data provided to provideInitialState by files","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36","version":"21.0.0.18"}
{"reqId":"QZOZGu18XVfDNih5FpPr","level":2,"time":"2021-04-03T10:02:23+00:00","remoteAddr":"89.221.214.191","user":"sitnarf","app":"no app in context","method":"GET","url":"/apps/files/","message":"Invalid data provided to provideInitialState by files","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36","version":"21.0.0.18"}
{"reqId":"dvaTDw9ZfJgYIHSljdcM","level":2,"time":"2021-04-03T10:02:25+00:00","remoteAddr":"89.221.214.191","user":"sitnarf","app":"no app in context","method":"GET","url":"/apps/files/","message":"Invalid data provided to provideInitialState by files","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36","version":"21.0.0.18"}
{"reqId":"47qwBWLu3oLG0H6bgYls","level":2,"time":"2021-04-03T10:02:27+00:00","remoteAddr":"89.221.214.191","user":"sitnarf","app":"no app in context","method":"GET","url":"/apps/files/","message":"Invalid data provided to provideInitialState by files","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36","version":"21.0.0.18"}
{"reqId":"eB3n5j12wuVPxBTYi2ks","level":2,"time":"2021-04-03T10:02:27+00:00","remoteAddr":"89.221.214.191","user":"sitnarf","app":"no app in context","method":"GET","url":"/apps/files/","message":"Invalid data provided to provideInitialState by files","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36","version":"21.0.0.18"}
{"reqId":"6DGfNWFflcnEuotl2AyX","level":2,"time":"2021-04-03T10:02:33+00:00","remoteAddr":"89.221.214.191","user":"sitnarf","app":"no app in context","method":"GET","url":"/apps/files/","message":"Invalid data provided to provideInitialState by files","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36","version":"21.0.0.18"}
{"reqId":"qBpxcUQMlbDlMhk2At67","level":2,"time":"2021-04-03T10:02:41+00:00","remoteAddr":"89.221.214.191","user":"sitnarf","app":"no app in context","method":"GET","url":"/apps/files/","message":"Invalid data provided to provideInitialState by files","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36","version":"21.0.0.18"}
{"reqId":"L8Kq2ZgUdeppKNzZUBzM","level":2,"time":"2021-04-03T10:02:55+00:00","remoteAddr":"89.221.214.191","user":"sitnarf","app":"no app in context","method":"GET","url":"/apps/files/","message":"Invalid data provided to provideInitialState by files","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36","version":"21.0.0.18"}
{"reqId":"HwTWRZi8u7jL2tBOlacB","level":2,"time":"2021-04-03T10:15:42+00:00","remoteAddr":"89.221.214.191","user":"sitnarf","app":"no app in context","method":"GET","url":"/apps/files/","message":"Invalid data provided to provideInitialState by files","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36","version":"21.0.0.18"}
{"reqId":"CUV0taSDoEKMuTjt41ap","level":2,"time":"2021-04-03T10:16:17+00:00","remoteAddr":"89.221.214.191","user":"sitnarf","app":"no app in context","method":"GET","url":"/apps/files/","message":"Invalid data provided to provideInitialState by files","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36","version":"21.0.0.18"}
{"reqId":"TC8dhANmdncs59LsPLr5","level":2,"time":"2021-04-03T13:13:47+00:00","remoteAddr":"89.221.214.191","user":"sitnarf","app":"no app in context","method":"GET","url":"/apps/files/","message":"Invalid data provided to provideInitialState by files","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36","version":"21.0.0.18"}
{"reqId":"NcNJycPxaZSD9huwwbf0","level":2,"time":"2021-04-03T19:06:36+00:00","remoteAddr":"89.221.214.191","user":"sitnarf","app":"no app in context","method":"GET","url":"/apps/files/","message":"Invalid data provided to provideInitialState by files","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36","version":"21.0.0.18"}
{"reqId":"xYGhMuF1Hhzx9d9Y3ZGJ","level":2,"time":"2021-04-03T19:23:23+00:00","remoteAddr":"89.221.214.191","user":"sitnarf","app":"no app in context","method":"GET","url":"/apps/files/","message":"Invalid data provided to provideInitialState by files","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36","version":"21.0.0.18"}
{"reqId":"AuXtSEe8wxiSDQnGh6JY","level":2,"time":"2021-04-03T19:23:33+00:00","remoteAddr":"89.221.214.191","user":"sitnarf","app":"no app in context","method":"GET","url":"/apps/files/","message":"Invalid data provided to provideInitialState by files","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36","version":"21.0.0.18"}

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'htaccess.RewriteBase' => '/',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/var/www/html/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 =>
    array (
      'path' => '/var/www/html/custom_apps',
      'url' => '/custom_apps',
      'writable' => true,
    ),
  ),
  'instanceid' => 'ocvuw29gz20j',
  'passwordsalt' => '****',
  'secret' => '****',
  'trusted_domains' =>
  array (
    0 => 'localhost:8080',
    1 => 'mydomain.cz',
  ),
  'trusted_proxies' =>
  array (
    0 => 'localhost',
    1 => '192.168.0.1',
  ),
  'overwriteprotocol' => 'https',
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '21.0.0.18',
  'overwrite.cli.url' => '****',
  'dbname' => 'nextcloud',
  'dbhost' => 'db',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'test',
  'installed' => true,
  'theme' => '',
  'loglevel' => 2,
  'maintenance' => false,
  'app_install_overwrite' =>
  array (
    0 => 'issuetemplate',
    1 => 'joplin',
    2 => 'richdocumentscode',
    3 => 'quicknotes',
    4 => 'health',
    5 => 'cookbook',
    6 => 'dashboardcharts',
  ),
);

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

nextcloud                  | 172.23.0.3 - - [04/Apr/2021:10:33:23 +0000] "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 304 249 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36"
nginx-proxy_1              | nginx.1    | mydomain.cz 89.221.214.191 - sitnarf [04/Apr/2021:10:33:45 +0000] "PROPFIND /remote.php/dav/files/sitnarf/ HTTP/1.1" 207 246 "-" "Mozilla/5.0 (Linux) mirall/3.1.3git (build 4849) (Nextcloud)"
nextcloud                  | 172.23.0.3 - - [04/Apr/2021:10:33:53 +0000] "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 304 249 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36"
nginx-proxy_1              | nginx.1    | mydomain.cz 89.221.214.191 - - [04/Apr/2021:10:33:53 +0000] "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/2.0" 304 0 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36"
nextcloud                  | 172.23.0.3 - - [04/Apr/2021:10:33:55 +0000] "PUT /apps/user_status/heartbeat HTTP/1.1" 204 686 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36"
nginx-proxy_1              | nginx.1    | mydomain.cz 89.221.214.191 - - [04/Apr/2021:10:33:56 +0000] "PUT /apps/user_status/heartbeat HTTP/2.0" 204 0 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36"
nextcloud                  | 172.23.0.3 - - [04/Apr/2021:10:33:56 +0000] "GET /ocs/v2.php/apps/user_status/api/v1/user_status HTTP/1.1" 200 920 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36"
nginx-proxy_1              | nginx.1    | mydomain.cz 89.221.214.191 - - [04/Apr/2021:10:33:56 +0000] "GET /ocs/v2.php/apps/user_status/api/v1/user_status HTTP/2.0" 200 150 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36"
nextcloud                  | 172.23.0.3 - - [04/Apr/2021:10:33:56 +0000] "GET /index.php/apps/files/ajax/getstoragestats.php?dir=%2F HTTP/1.1" 200 978 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36"
nginx-proxy_1              | nginx.1    | mydomain.cz 89.221.214.191 - - [04/Apr/2021:10:33:56 +0000] "GET /index.php/apps/files/ajax/getstoragestats.php?dir=%2F HTTP/2.0" 200 208 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36"
nextcloud                  | 172.23.0.3 - sitnarf [04/Apr/2021:10:33:58 +0000] "GET /index.php/apps/bookmarks/public/rest/v2/folder/-1/hash HTTP/1.1" 200 1704 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36"
nginx-proxy_1              | nginx.1    | mydomain.cz 89.221.214.191 - sitnarf [04/Apr/2021:10:33:58 +0000] "GET /index.php/apps/bookmarks/public/rest/v2/folder/-1/hash HTTP/2.0" 200 96 "-" "Mozilla/5.0 (X11; Linux 
ko) Chrome/89.0.4389.90 Safari/537.36"
x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36"
nextcloud                  | 172.23.0.3 - - [04/Apr/2021:10:35:06 +0000] "REPORT /remote.php/dav/calendars/sitnarf/work-1/ HTTP/1.1" 207 839 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36"
nginx-proxy_1              | nginx.1    | mydomain.cz 89.221.214.191 - - [04/Apr/2021:10:35:07 +0000] "REPORT /remote.php/dav/calendars/sitnarf/work-1/ HTTP/2.0" 207 239 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36"
nextcloud                  | 172.23.0.3 - - [04/Apr/2021:10:35:07 +0000] "REPORT /remote.php/dav/calendars/sitnarf/personal/ HTTP/1.1" 207 839 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36"
nginx-proxy_1              | nginx.1    | mydomain.cz 89.221.214.191 - - [04/Apr/2021:10:35:07 +0000] "REPORT /remote.php/dav/calendars/sitnarf/personal/ HTTP/2.0" 207 239 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36"
nginx-proxy_1              | nginx.1    | mydomain.cz 89.221.214.191 - - [04/Apr/2021:10:35:07 +0000] "REPORT /remote.php/dav/calendars/sitnarf/tasks/ HTTP/2.0" 207 34673 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36"
ke Gecko) Chrome/89.0.4389.90 Safari/537.36"
nginx-proxy_1              | nginx.1    | mydomain.cz 89.221.214.191 - - [04/Apr/2021:10:35:23 +0000] "GET /apps/accessibility/js/accessibilityoca.js.map HTTP/2.0" 200 16318 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36"
nextcloud                  | 172.23.0.3 - - [04/Apr/2021:10:35:23 +0000] "GET /apps/files_pdfviewer/js/files_pdfviewer-public.js.map?v=15d058082286d206e4c8 HTTP/1.1" 200 30096 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36"
nginx-proxy_1              | nginx.1    | mydomain.cz 89.221.214.191 - - [04/Apr/2021:10:35:23 +0000] "GET /apps/files_pdfviewer/js/files_pdfviewer-public.js.map?v=15d058082286d206e4c8 HTTP/2.0" 200 29565 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36"
nextcloud                  | 172.23.0.3 - - [04/Apr/2021:10:35:23 +0000] "GET /core/js/dist/files_fileinfo.js.map HTTP/1.1" 200 35611 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36"
nginx-proxy_1              | nginx.1    | mydomain.cz 89.221.214.191 - - [04/Apr/2021:10:35:23 +0000] "GET /core/js/dist/files_fileinfo.js.map HTTP/2.0" 200 35080 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36"
nextcloud                  | 172.23.0.3 - - [04/Apr/2021:10:35:23 +0000] "GET /core/js/dist/files_client.js.map HTTP/1.1" 200 181779 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ch
Chrome/89.0.4389.90 Safari/537.36"

It seems it has been resolved on its own! Perhaps an update!