Nextcloud is requesting weird DNS records failing to load apps

Nextcloud version 27.1.0
Operating system and version Ubuntu 22.04, virtualized with Docker
Docker Version: Docker version 20.10.21, build 20.10.21-0ubuntu1~22.04.3
Apache or nginx version 2.4.57
PHP version 8.2.10

Hello, I am having an issue with a new install. I can’t load the apps page, since it seems to be making faulty DNS requests. It seems that my instance is making requests looking for *.nextcloud.com.<mydomain>.com. I don’t know why that is happening. I have seen these requests in the logs of my pihole instance.

Is this the first time you’ve seen this error? (Y/N): Yes, this is a fresh install

Steps to replicate it:

  1. Open the web app
  2. Navigate to the Apps menu
  3. It takes a long time to load, when it eventually loads, no apps load, just an eternal pinwheel
  4. Eventually an error notification happens that says an error occurred (don’t have the exact text)

The output of your Nextcloud log in Admin > Logging:

[PHP] Error: dns_get_record(): A temporary server error occurred. at /var/www/html/lib/private/Http/Client/DnsPinMiddleware.php#84

GET /settings/ajax/checksetup
from <my laptop's local IP> by <username> at 2023-09-23T20:49:16+00:00

The contents of my config/config.php

<?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,
    ),
  ),
  'passwordsalt' => 'redacted',
  'secret' => 'redacted',
  'trusted_domains' =>
  array (
	  0 => 'localhost',
	  1 => 'nextcloud.example.com',
  ),
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '27.1.0.7',
  'overwrite.cli.url' => 'http://localhost',
  'dbname' => 'nextcloud',
  'dbhost' => 'database',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'redacted',
  'installed' => true,
  'instanceid' => 'redacted',

  'overwritehost' => 'nextcloud.example.com',
  'overwriteprotocol' => 'https',
  #'overwrite.cli.url' => 'https://nextcloud.example.com',
  #'overwritewebroot' => '/',

);

I am unable to find the Apache logs. I tried getting a bash shell into my container and cat /var/log/apache2/{access,error}.log but they just hung and didn’t output anything.

Here is my docker-compose for nextcloud (it’s actually a Portainer Stack, but still)

version: '2'
services:
  database:
    image: mariadb:10.6
    restart: always
    command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW
    volumes:
      - /home/<username>/data/nextcloud/db:/var/lib/mysql


    environment:
      - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
      - MYSQL_PASSWORD=${MYSQL_PASSWORD}
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud

  app:
    image: nextcloud
    restart: always
    ports:
      - 8090:80
    links:
      - database
    volumes:   
      - /home/<username>/data/nextcloud/data:/var/www/html #Main folder, needed for updating
      - /home/<username>/data/nextcloud/custom_apps:/var/www/html/custom_apps #installed / modified apps
      - /home/<username>/data/nextcloud/config:/var/www/html/config #local configuration
      - /mnt/media/nextcloud/data:/var/www/html/data #the actual data of your Nextcloud
      #- /var/www/html/themes/<YOUR_CUSTOM_THEME> #theming/branding
    environment:
      - MYSQL_PASSWORD=${MYSQL_PASSWORD}
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_HOST=database
      - NEXTCLOUD_ADMIN_USER=nextcloud
      - NEXTCLOUD_ADMIN_PASSWORD=${MYSQL_PASSWORD}

For more background, I am running this behind Nginx Proxy Manager as my reverse proxy with SSL. I am also seeing this on the Overview for the Admin settings. I have a feeling this is related, since it can’t reach out of the container due to the bad DNS results.

I have seen a couple different failures in pihole. I have seen where it requested apps.nextcloud.com.<domain>.com which obviously returns NXDOMAIN. I have also seen it request a CNAME for apps.nextcloud.com which returns NODATA. Which kinda makes sense, since when I do nslookup apps.nextcloud.com I receive an A record, not CNAME.

I hope someone can offer some help.

Hi Guys and Gals

i got the same issue today. whereas the net connection is perfectly fine from the nextcloud machine and the url mentioned in the logs are accessible from that machine also

i was trying to rectify issue with the snap nextcloud for not being able to upload file bigger than 1 mb