Some image paths use server hostname instead of no-ip address

I just today installed NextCloud 12 on my Debian Stretch system. Everything works fine. When I open NC by https://192.168.1.50 or https://serverHostName all the images load fine. But when I go to the site using my no-ip url https://myDomain.no-ip.org then some images don’t load. Looking at the HTML the path for the images is https://serverHostName....

Any idea how to fix this? Here is an excerpt of my configuration files:

/var/www/nextcloud/config/config.php

<?php
$CONFIG = array(
  'instanceid' => '***',
  'passwordsalt' => '***',
  'secret' => '***',
  'trusted_domains' =>
  array (
    0 => '192.168.1.50',
    1 => 'myDomain.noip.me',
    2 => 'serverHostName',
  ),
  'datadirectory' => '/data/nextcloud',
  'overwrite.cli.url' => 'https://myDomain.noip.me',
  'dbtype' => 'mysql',
  'version' => '12.0.0.29',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => '***',
  'installed' => true,
  'memcache.local' => '\\OC\\Memcache\\ACPu',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'filelocking.enabled' => 'true',
  'redis' =>
  array (
    'host' => '/var/run/redis/redis.sock',
    'port' => 0,
    'timeout' => 0.0,
  ),
  'htaccess.RewriteBase' => '/',
  'enable_previews' => true,
  'mail_from_address' => 'myDomain',
  'mail_smtpmode' => 'php',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_domain' => 'gmail.com',
  'overwritewebroot' => '/',
  'overwritehost' => 'myDomain.noip.me',
  'overwriteprotocol' => 'https',
  'check_for_working_htaccess' => true,
  'check_for_working_wellknown_setup' => true,
  'check_for_working_webdav' => true,
  'has_internet_connection' => true,
  'log_rotate_size' => 104857600,
  'cron_log' => true,
);

/etc/apache2/apache2.conf

DefaultRuntimeDir ${APACHE_RUN_DIR}
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
HostnameLookups Off
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf
Include ports.conf
<Directory />
        Options FollowSymLinks
        AllowOverride None
        Require all denied
</Directory>
<Directory /usr/share>
        AllowOverride None
        Require all granted
</Directory>
<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
</Directory>
AccessFileName .htaccess
<FilesMatch "^\.ht">
        Require all denied
</FilesMatch>
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
IncludeOptional conf-enabled/*.conf
IncludeOptional sites-enabled/*.conf

/etc/apache2/sites-enabled/000-default.conf

<VirtualHost *:80>
    ServerAdmin myEmail@gmail.com
    DocumentRoot /var/www/nextcloud
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]
</VirtualHost>

/etc/apache2/sites-enabled/000-default-le-ssl.conf

<IfModule mod_ssl.c>
    <VirtualHost *:443>
        ServerAdmin myEmail@gmail.com
        DocumentRoot /var/www/nextcloud

        <Directory /var/www/nextcloud/>
            Options +FollowSymlinks
            AllowOverride All
            <IfModule mod_dav.c>
                    Dav off
            </IfModule>
            SetEnv HOME /var/www/nextcloud
            SetEnv HTTP_HOME /var/www/nextcloud
        </Directory>
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
        SSLCertificateFile /etc/letsencrypt/live/myDomain.noip.me/fullchain.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/myDomain.noip.me/privkey.pem
        Include /etc/letsencrypt/options-ssl-apache.conf
        ServerName myDomain.noip.me
        Protocols h2 http/1.1
        <IfModule mod_headers.c>
                Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains; preload"
        </IfModule>
    </VirtualHost>
</IfModule>

Can you remove the direct ip-address from the trusted.domains and try again?
Also, have a look in /etc/hosts file.

tried that but it didn’t work.

looks like i am getting the CSP error too so i will close this thread and open a new one with more details.

Exact same problem here. When receiving my activitiy-survey email, all links will be set using my internal hostname and not my no-ip.org-address.
I already fiddled with my hostname and the trust.domains but this didn’t work.

Any clue?