.well-known redirection works, but still annoying setup_warnings

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 20.0.5): 25.0.3
Operating system and version (eg, Ubuntu 20.04): nextcloud:25.0.3-apache (linux/arm64/v8)
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.54
PHP version (eg, 7.4): 8.1.15

The issue you are facing:
Service discovery works, but still getting setup_warning in admin webinterface for webfinger, nodeinfo, caldav, carddav.

Is this the first time you’ve seen this error? (Y/N): No, had it since the first setup two years ago

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' => 'ochb99sbkw3l',
  'trusted_domains' =>
  array (
    0 => 'nextcloud:80',
    1 => 'my.cloud.example.com',
  ),
  'trusted_proxies' =>
  array (
    0 => 'traefik',
  ),
  'overwrite.cli.url' => 'https://my.cloud.example.com/nc',
  'overwritehost' => 'my.cloud.example.com',
  'overwritewebroot' => '/nc',
  'overwriteprotocol' => 'https',
  'passwordsalt' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
  'secret' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '25.0.3.2',
  'dbname' => 'nextcloud',
  'dbhost' => 'db',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'nextcloud',
  'dbpassword' => 'SomethingSecret',
  'installed' => true,
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
  'mysql.utf8mb4' => true,
  'mail_smtpmode' => 'smtp',
  'mail_smtphost' => 'my.cloud.example.com',
  'mail_sendmailmode' => 'smtp',
  'mail_smtpport' => '25',
  'mail_from_address' => 'nextcloud',
  'mail_domain' => 'raspmail.pi',
  'default_phone_region' => 'DE',
);

Nextcloud runs as a docker container (nextcloud:25.0.3-apache) behind a reverseproxy (traefik:v2.1.6) on a raspberry pi 4 (64bit).
The setup is up and running for over two years and several nextcloud iterations.
But since the first setup I was unable to resolve the service discovery warnings in the webinterface.
On the first editions it was only the caldav/carddav warnings, later also the webfinger/nodeinfo warnings accompanied the former.
I tried several proposed solutions that I found on here and some other sources, but so far could not resolve the warnings.
Maybe a fresh pair of eyes can help here…

I host several webservices on the pi (mail, webmail, logging, nextcloud) which are located behind a traefik proxy.
The following (static) traefik config works with my setup, but does not resolve the admin gui warnings (the commented out sections were fix attempts, but did not succeed):

Traefik dynamic.yml

# tcp routing section
tcp:
  routers:

    dovecot:
      entryPoints:
        - "imaps"
      service: dovecot
      rule: "HostSNI(`my.cloud.example.com`)"
      tls:
        passthrough: true

  services:

    dovecot:
      loadBalancer:
        terminationDelay: -1
        servers:
          - address: "dovecot:993"

# http routing section
http:
  routers:

    redirectToHttps:
      entryPoints:
        - "lan"
      service: NeededButNeverUsed
      rule: "HostRegexp(`{host:.+}`)"
      middlewares:
      - httpsredirect

    nextcloud:
      entryPoints:
        - "ncweb"
        - "lan-secure"
      service: nextcloud
      rule: "Host(`my.cloud.example.com`) && PathPrefix(`/nc`)"
      middlewares:
       - redirectDAV
       - replaceWellKnown
       - removeServiceSelector
       - ncSecHeader
      tls:
        certResolver: cloud_example

    api:
      entryPoints:
         - "lan-secure"
      rule: PathPrefix(`/api`) || PathPrefix(`/dashboard`)
      service: api@internal
      middlewares:
        - api-auth
      tls:
        certResolver: cloud_example

    fhem:
      entryPoints:
        - "lan-secure"
      service: fhem
      rule: "Host(`my.cloud.example.com`) && PathPrefix(`/fhem`)"
      middlewares:
       - removeServiceSelector
      tls:
        certResolver: cloud_example

    lggr:
      entryPoints:
         - "lan-secure"
      service: lggr
      rule: "Host(`my.cloud.example.com`) && PathPrefix(`/lggr`)"
      middlewares:
       - removeServiceSelector
      tls:
        certResolver: cloud_example

    roundcube:
      entryPoints:
        - "lan-secure"
      service: roundcube
      rule: "Host(`my.cloud.example.com`) && PathPrefix(`/rdcb`)"
      middlewares:
       - removeServiceSelector
      tls:
        certResolver: cloud_example

    generated_but_not_hosted:
      rule: "Host(`unhosted.cloud.example.com`)"
      entrypoint:
        - none
      service: NeededButNeverUsed
      tls:
        certResolver: cloud_example
        domains:
          - main: "app1.cloud.example.com"
          - main: "app2.cloud.example.com"
          - main: "app3.cloud.example.com"
          - main: "app4.cloud.example.com"

  services:
    NeededButNeverUsed:
      loadBalancer:
        servers:
          - url: "http://localhost/"
    fhem:
      loadBalancer:
        servers:
          - url: "http://fhem:8083/"
    lggr:
      loadBalancer:
        servers:
          - url: "http://lggr:80/"
    nextcloud:
      loadBalancer:
        servers:
          - url: "http://nextcloud:80/"
    roundcube:
      loadBalancer:
        servers:
          - url: "http://roundcube:80/"


  middlewares:
    httpsredirect:
      redirectScheme:
        scheme: https
    api-auth:
      basicAuth:
        users:
          - "andy:SuperSecretHash"
    removeServiceSelector:
      stripPrefix:
        prefixes:
          - "/nc"
          - "/fhem"
          - "/lggr"
          - "/rdcb"
        forceSlash: true
    ncSecHeader:
      headers:
        forceSTSHeader: true
        stsPreload: true
        stsSeconds: 15552000
        contentTypeNosniff: true
        browserXssFilter: true
        sslHost: my.cloud.example.com
        stsIncludeSubdomains: true
        referrerPolicy: "no-referrer"
        customFrameOptionsValue: "SAMEORIGIN"
        customRequestHeaders:
          X-Forwarded-Proto: https
    redirectDAV:
##      replacePathRegex:
##        regex: "^/.well-known/ca(l|rd)dav"
##        replacement: "/remote.php/dav/"
      redirectRegex:
        permanent: true
        regex: "https?://([^/]*)/nc/.well-known/(card|cal)dav"
###        replacement: "https://$${1}/nc/remote.php/dav/"
        replacement: "https://${1}/nc/remote.php/dav/"
#        regex: "^https://(.*)/.well-known/(card|cal)dav"
#        replacement: "https://${1}/remote.php/dav/"
##        replacement: "https://${1}/remote.php/dav"
##        regex: "https://(.*)/.well-known/(?:card|cal)dav"
    replaceWellKnown:
      redirectRegex:
        permanent: true
        regex: "https?://([^/]*)/nc(/.well-known[^#]*)"
        replacement: "https://${1}/nc/index.php${2}"
#      replacePathRegex:
#        regex: "^(/.well-known.*)"
#        replacement: "/index.php$${1}"

After each correction attempt the traefik and nextcloud container were restarted and a fresh incognito browser window was used for checking the admin gui status.

Could it be this trailing slash? They don’t have that in the documentation.

Nope, no luck.
Removed it and the warnings remain.

Ok, did some more digging and found out that the response to the ajax request (when loading the adminconfig page) is missing the subdoman /nc in it.

My question is, what in the config do I need to adjust that nextcloud recognizes/uses the /nc subdomain?