NextCloud Snap, NextCloud Office Not Starting because of http/https errors

  • Nextcloud version (eg, 20.0.5): Nextcloud Hub 4 (26.0.3)

  • Operating system and version (eg, Ubuntu 20.04): Ubuntu 22.04.2 LTS

  • Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.52 (Ubuntu)

  • PHP version (eg, 7.4): PHP 8.1.2-1ubuntu2.13 (cli), Zend Engine v4.1.2

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

Steps to replicate it:

  1. Install NC snap.
  2. Configure Apache to work with snap in parallel to existing webserver.
  3. Install Nextcloud Office.
  4. Watch the blank screen when opening an office document.

The output of your Nextcloud log in Admin > Logging:

Hi everyone. Thanks in advance for all your help. I’ve been struggling for weeks trying to get this working for our small organization. I’m trying to run Nextcloud on a VPS-like configuration (I installed Ubuntu Server LTS on it). I have an Apache webserver running a WordPress site conventionally. After many failures trying a regular install of Nextcloud, I tried Docker and that had problems, and now I’m using the Snap version of Nextcloud which has made significant improvements. At least Nextcloud runs now. Unfortunately this is all beyond my level of knowledge and none of the guides online seem to address the issue in a way I can understand.

But I cannot get Nextcloud Office working, which is an absolute requirement.

The Problem:
When an office document is clicked on for editing, the Office editor never appears. An inspection of the document reveals a possible root cause of mixed domains being served by NextCloud Office (http) even though the main part of Nextcloud is https.

Depending on the random thing I try, I get the following general categories of problems in the browser’s console which results in a black screen when loading any office document:


B) ConsoleLogger.js:59 [ERROR] files: Could not refresh storage stats {app: ‘files’, uid: ‘trogdor’, level: 2, error: i}

C) core-common.js?v=436578ce-1:2 Refused to connect to ‘’ because it violates the following Content Security Policy directive: “connect-src ‘self’”.

D) core-common.js?v=436578ce-1:2 Mixed Content: The page at ‘’ was loaded over a secure connection, but contains a form that targets an insecure endpoint ‘’. This endpoint should be made available over a secure connection.

Computer Configuration

        Apache web server
            --> Wordpress
            --> Nextcloud Snap

Server IP & domain

Domain and IP have been changed for privacy but:

Note: Apache / MySQL / PHP WordPress site running on


Snap is configured to use port 8080 and 8443, since it would otherwise conflict with Apache.

  • sudo snap set nextcloud ports.http=8080
  • sudo snap set nextcloud ports.https=8443

Trusted Proxy

sudo nextcloud.occ config:system:set trusted_proxies 1 --value=


  • Using proxy to get SSL certificates.


<VirtualHost *:80>
        Header always set Strict-Transport-Security "max-age=31536000; includeS>
        ErrorLog ${APACHE_LOG_DIR}/nextcloud-error.log
        CustomLog ${APACHE_LOG_DIR}/nextcloud-access.log combined
        ProxyPreserveHost On
        ProxyPass /
        ProxyPassReverse /
        RewriteEngine on
        #RewriteCond %{SERVER_NAME}
        #RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanen>
        RewriteRule ^/\.well-known/carddav http://%{SERVER_NAME}/remote.php/dav>
        RewriteRule ^/\.well-known/caldav http://%{SERVER_NAME}/remote.php/dav/


<VirtualHost *:443>
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomain>
        SSLProxyEngine On
        SSLProxyVerify None
        SSLProxyCheckPeerCN Off
        SSLProxyCheckPeerExpire Off
        SSLProxyCheckPeerName off
        SSLVerifyClient none
        ProxyRequests Off
        ProxyPreserveHost On
        SSLCertificateFile /etc/letsencrypt/live/>
        SSLCertificateKeyFile /etc/letsencrypt/live/>
        # listens on ports 8080 and 8443
        ProxyPass /
            #ProxyPass /
        ProxyPassReverse /
            #ProxyPassReverse /
        RewriteEngine On
        RewriteRule ^/\.well-known/carddav https://%{SERVER_NAME}/remote.php/da>
        RewriteRule ^/\.well-known/caldav https://%{SERVER_NAME}/remote.php/dav>


$CONFIG = array (
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/snap/nextcloud/current/htdocs/apps',
      'url' => '/apps',
      'writable' => false,
    1 =>
    array (
      'path' => '/var/snap/nextcloud/current/nextcloud/extra-apps',
      'url' => '/extra-apps',
      'writable' => true,
  'supportedDatabases' =>
  array (
    0 => 'mysql',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/tmp/sockets/redis.sock',
    'port' => 0,
  'log_type' => 'file',
  'logfile' => '/var/snap/nextcloud/current/logs/nextcloud.log',
  'logfilemode' => 416,
  'passwordsalt' => 'xxxxxxxxxxxxxxx',
  'secret' => 'xxxxxxxxxxxxxxxxxxxxxxxxxx',
  'trusted_domains' =>
  array (
    0 => 'localhost',
    1 => '',
  'datadirectory' => '/var/snap/nextcloud/common/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '',
  'overwrite.cli.url' => 'http://localhost',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost:/tmp/sockets/mysql.sock',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'xxxxxxxxxxxxxxxxxxxxxxx>
  'installed' => true,
  'instanceid' => 'ocy3e1cpaznr',
  'maintenance' => false,
  'mail_smtpmode' => 'smtp',
  'mail_smtpsecure' => 'ssl',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => 'nextcloud',
  'mail_domain' => '',
  'mail_smtphost' => '',
  'mail_smtpport' => '465',
  'mail_smtpauth' => 1,
  'default_phone_region' => 'US',
  'overwritehost' => '',
  'overwriteprotocol' => 'https',
  'mail_smtpname' => '',
  'mail_smtppassword' => 'xxxxxxxxxxxxxxxxxxxx',
  'trusted_proxies' =>
  array (
    1 => '',

EDIT: cross referencing to a similar thread… possibly the exact same problem. Nextcloud Office showing only Loading - #15 by Adam42

1 Like

This completely solved it for me!


<IfModule mod_ssl.c>
<VirtualHost *:443>
 ServerName www.(MYDOMAIN)
 ProxyPreserveHost On 
 DocumentRoot /var/www/html
 ProxyPass /.well-known !
 ProxyPass / flushpackets=on
 ProxyPassReverse /
 LimitRequestBody 0

 RequestHeader set X-Forwarded-SSL "1"
 RequestHeader set X-Forwarded-Proto "https" env=HTTPS

 <IfModule mod_headers.c>
   RewriteEngine On
   Header always set Strict-Transport-Security "max-age=15768000; preload"
   Redirect 301 /.well-known/carddav https://www.(MYDOMAIN)/remote.php/dav
   Redirect 301 /.well-known/caldav https://www.(MYDOMAIN)/remote.php/dav
   Redirect 301 /.well-known/webfinger https://www.(MYDOMAIN)/index.php/.well-known/webfinger
   Redirect 301 /.well-known/nodeinfo https://www.(MYDOMAIN)/index.php/.well-known/nodeinfo
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/(MYDOMAIN)-0003/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/(MYDOMAIN)-0003/privkey.pem

What’s the key difference then? (Sorry apache xml config files are not my strong point!)

I don’t really know. I just blindly took it from the referenced forum. Someone else figured it out.