Add federation trusted server

Bonjour, :waving_hand:

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • 34.0.1
  • Operating system and version (e.g., Ubuntu 24.04):
    • Ubuntu 26.04
  • Is this the first time you’ve seen this error? (Yes / No):
    • Yes
  • When did this problem seem to first start?
    • After add trusted server
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • AIO
  • Are you using CloudfIare, mod_security, or similar? (Yes / No)
    • No

Summary of the issue you are facing:

I have 2 instance NextCloud AIO, when I add each others to trusted servers list, I never add verified and trusted server.

Steps to replicate it (hint: details matter!):

  1. Administration

  2. Add https:// url in truted servers list

Log entries

Nextcloud

On one server:

ClientExceptionClient error: `POST https://NEXTLOUD-URL-MASKED-SERVER1/ocm/notifications` resulted in a `403 Forbidden` response: {"message":"RESOURCE_NOT_FOUND"}
error while sending notification for federated share: Client error: `POST https://NEXTLOUD-URL-MASKED-SERVER1/ocm/notifications` resulted in a `403 Forbidden` response: {"message":"RESOURCE_NOT_FOUND"} 

On second:

InvalidArgumentExceptionInvalid Federated Cloud ID

Web server / Reverse Proxy

I have Traefik on front, but no errors logs.

But in Apache, I have this error:

{
  "level": "error",
  "ts": 1788167799.4730844,
  "logger": "http.log.error",
  "msg": "readfrom tcp 127.0.0.1:35104->127.0.0.1:8000: write tcp 127.0.0.1:35104->127.0.0.1:8000: use of closed network connection",
  "request": {
    "remote_ip": "10.0.2.7",
    "remote_port": "36524",
    "client_ip": "172.23.0.1",
    "proto": "HTTP/1.1",
    "method": "POST",
    "host": "NEXTCLOUD-URL-MASKED-SERVER2",
    "uri": "/ocs/v2.php/apps/federation/trusted-servers",
    "headers": {
      "X-Forwarded-Port": [
        "443"
      ],
      "X-Forwarded-Server": [
        "ff55405c0fe5"
      ],
      "X-Requested-With": [
        "XMLHttpRequest, XMLHttpRequest"
      ],
      "Content-Type": [
        "application/json"
      ],
      "Dnt": [
        "1"
      ],
      "Content-Length": [
        "43"
      ],
      "User-Agent": [
        "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:154.0) Gecko/20100101 Firefox/154.0"
      ],
      "Priority": [
        "u=0"
      ],
      "Referer": [
        "https://NEXTCLOUD-URL-MASKED-SERVER2/settings/admin/sharing"
      ],
      "Requesttoken": [
        "QEKbAnBrO+GGCWq+BJic+DdmT6ybfEJxTWyF4jD9SJs=:awbMUxIZCNbJU1nNMsD6jAUjCM/KCAhafiHQqkbWPqo="
      ],
      "Sec-Fetch-Site": [
        "same-origin"
      ],
      "Traceparent": [
        "00-15577a76727f9b71523193c09efbe0de-4eb78c49e04ce24e-01"
      ],
      "X-Forwarded-Host": [
        "NEXTCLOUD-URL-MASKED-SERVER2"
      ],
      "Te": [
        "trailers"
      ],
      "X-Forwarded-Proto": [
        "https"
      ],
      "X-Real-Ip": [
        "172.23.0.1"
      ],
      "Cookie": [
        "REDACTED"
      ],
      "Sec-Fetch-Dest": [
        "empty"
      ],
      "Sec-Gpc": [
        "1"
      ],
      "Accept": [
        "application/json, text/plain, */*"
      ],
      "Accept-Language": [
        "fr-FR,en-US;q=0.9,en;q=0.8"
      ],
      "Sec-Fetch-Mode": [
        "cors"
      ],
      "Origin": [
        "https://NEXTCLOUD-URL-MASKED-SERVER2"
      ],
      "X-Forwarded-For": [
        "172.23.0.1"
      ],
      "Accept-Encoding": [
        "gzip, deflate, br, zstd"
      ]
    }
  },
  "duration": 0.001185474,
  "status": 502,
  "err_id": "tbwp6nyd5",
  "err_trace": "reverseproxy.statusError (reverseproxy.go:1626)"
}

Configuration

Nextcloud

The output of occ config:list system or similar is best, but, if not possible, the contents of your config.php file from /path/to/nextcloud is fine (make sure to remove any identifiable information!):

<?php

/*
 * WARNING
 *
 * This file gets modified by automatic processes and all lines that are not
 * active code (ie. comments) are lost during that process.
 *
 * If you want to document things with comments or use constants add your settings
 * in a '<NAME>.config.php' file which will be included and rendered into this file.
 *
 * Example:
 *   <?php
 *   $CONFIG = [];
 *
 * See also: https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/config_sample_php_parameters.html#multiple-merged-configuration-files
 */
$CONFIG = array (
  'one-click-instance' => true,
  'one-click-instance.user-limit' => 100,
  '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,
    ),
  ),
  'check_data_directory_permissions' => false,
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => 'nextcloud-aio-redis',
    'password' => 'XXXXXXXX',
    'port' => 6379,
    'timeout' => 3.0,
    'read_timeout' => 10.0,
  ),
  'overwritehost' => 'NEXTCLOUD-URL-MASKED-SERVER1',
  'overwriteprotocol' => 'https',
  'passwordsalt' => 'XXXXXXXX',
  'secret' => 'XXXXXXXX',
  'trusted_domains' => 
  array (
    0 => 'localhost',
    1 => 'NEXTCLOUD-URL-MASKED-SERVER1',
  ),
  'datadirectory' => '/mnt/ncdata',
  'dbtype' => 'pgsql',
  'version' => '34.0.1.2',
  'overwrite.cli.url' => 'https://NEXTCLOUD-URL-MASKED-SERVER1/',
  'dbname' => 'nextcloud_database',
  'dbhost' => 'nextcloud-aio-database:5432',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'oc_nextcloud',
  'dbpassword' => 'XXXXXXXX',
  'installed' => true,
  'instanceid' => 'XXXXXXXX',
  'maintenance' => false,
  'updatechecker' => true,
  'loglevel' => 2,
  'log_type' => 'file',
  'logfile' => '/var/www/html/data/nextcloud.log',
  'log_rotate_size' => 10485760,
  'log.condition' => 
  array (
    'apps' => 
    array (
      0 => 'admin_audit',
    ),
  ),
  'preview_max_x' => 2048,
  'preview_max_y' => 2048,
  'jpeg_quality' => 60,
  'enabledPreviewProviders' => 
  array (
    1 => 'OC\\Preview\\Image',
    2 => 'OC\\Preview\\MarkDown',
    3 => 'OC\\Preview\\MP3',
    4 => 'OC\\Preview\\TXT',
    5 => 'OC\\Preview\\OpenDocument',
    6 => 'OC\\Preview\\Movie',
    7 => 'OC\\Preview\\Krita',
    0 => 'OC\\Preview\\Imaginary',
    23 => 'OC\\Preview\\ImaginaryPDF',
  ),
  'enable_previews' => true,
  'upgrade.disable-web' => true,
  'mail_smtpmode' => 'smtp',
  'trashbin_retention_obligation' => 'auto, 30',
  'versions_retention_obligation' => 'auto, 30',
  'activity_expire_days' => 30,
  'simpleSignUpLink.shown' => false,
  'share_folder' => '/Shared',
  'one-click-instance.link' => 'https://nextcloud.com/all-in-one/',
  'upgrade.cli-upgrade-link' => 'https://github.com/nextcloud/all-in-one/discussions/2726',
  'updatedirectory' => '/nc-updater',
  'maintenance_window_start' => 100,
  'allow_local_remote_servers' => true,
  'davstorage.request_timeout' => 3600,
  'documentation_url.server_logs' => 'https://github.com/nextcloud/all-in-one/discussions/5425',
  'htaccess.RewriteBase' => '/',
  'dbpersistent' => false,
  'auth.bruteforce.protection.enabled' => true,
  'ratelimit.protection.enabled' => true,
  'files_external_allow_create_new_local' => false,
  'trusted_proxies' => 
  array (
    0 => '127.0.0.1',
    1 => '::1',
    10 => '172.21.0.0/16',
  ),
  'preview_imaginary_url' => 'http://nextcloud-aio-imaginary:9000',
  'preview_imaginary_key' => 'XXXXXXXX',
  'default_phone_region' => 'FR',
  'default_language' => 'fr',
  'default_locale' => 'fr_FR',
  'skeletondirectory' => '',
  'knowledgebaseenabled' => 'false',
  'mail_smtphost' => 'XXXXXXXX',
  'mail_smtpport' => 'XXXXXXXX',
  'mail_smtpauthtype' => 'XXXXXXXX',
  'mail_domain' => 'XXXXXXXX',
  'mail_from_address' => 'XXXXXXXX',
  'mail_smtppassword' => 'XXXXXXXX',
  'mail_smtpauth' => true,
  'serverid' => 445,
  'log_type_audit' => 'file',
  'logfile_audit' => '/var/www/html/data/audit.log',
  'update_channel' => 'stable',
  'memories.db.triggers.fcu' => true,
  'memories.exiftool' => '/var/www/html/custom_apps/memories/bin-ext/exiftool-amd64-musl',
  'memories.vod.path' => '/var/www/html/custom_apps/memories/bin-ext/go-vod-amd64',
  'memories.vod.ffmpeg' => '/usr/bin/ffmpeg',
  'memories.vod.ffprobe' => '/usr/bin/ffprobe',
);

Two instances have same similars settings.

I don’t know.

Thanks !