No server to federate with found (trusted-servers 400 Bad request)

Hello, the federation is not working.
When adding a server nextcloud.server2.com, I get the error “The server for unification was not found”

When sharing a resource, I get the error: “Error creating the share: Sharing federation.md failed, could not find user@nextcloud.server2.com, maybe the server is currently unreachable or uses a self-signed certificate.”

Help me figure out why the federation is not working

NC25.0.2
PHP 7.4.33
App Federation 1.15.0

Inspect network activity:

https://nextcloud.server1.com/index.php/apps/federation/trusted-servers
400 Bad request

Nextcloud log:

{
  "reqId": "4rLQwonHL2kosXiJR43t",
  "level": 2,
  "time": "2023-01-16T21:53:16+00:00",
  "remoteAddr": "10.10.1.10",
  "user": "admin",
  "app": "no app in context",
  "method": "POST",
  "url": "/index.php/apps/federation/trusted-servers",
  "message": "Could not detect any host in nextcloud.server2.com/status.php",
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36",
  "version": "25.0.2.3",
  "data": []
}
{
  "reqId": "4rLQwonHL2kosXiJR43t",
  "level": 3,
  "time": "2023-01-16T21:53:16+00:00",
  "remoteAddr": "10.10.1.10",
  "user": "admin",
  "app": "federation",
  "method": "POST",
  "url": "/index.php/apps/federation/trusted-servers",
  "message": "No Nextcloud server.",
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36",
  "version": "25.0.2.3",
  "exception": {
    "Exception": "OCP\\Http\\Client\\LocalServerException",
    "Message": "Could not detect any host",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/nextcloud/lib/private/Http/Client/Client.php",
        "line": 184,
        "function": "ThrowIfLocalAddress",
        "class": "OC\\Http\\Client\\LocalAddressChecker",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Http/Client/Client.php",
        "line": 217,
        "function": "preventLocalAddress",
        "class": "OC\\Http\\Client\\Client",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/federation/lib/TrustedServers.php",
        "line": 167,
        "function": "get",
        "class": "OC\\Http\\Client\\Client",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/federation/lib/Controller/SettingsController.php",
        "line": 88,
        "function": "isNextcloudServer",
        "class": "OCA\\Federation\\TrustedServers",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/federation/lib/Controller/SettingsController.php",
        "line": 55,
        "function": "checkServer",
        "class": "OCA\\Federation\\Controller\\SettingsController",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 225,
        "function": "addServer",
        "class": "OCA\\Federation\\Controller\\SettingsController",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 133,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
        "line": 172,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Route/Router.php",
        "line": 298,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud/lib/base.php",
        "line": 1047,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/index.php",
        "line": 36,
        "function": "handleRequest",
        "class": "OC",
        "type": "::"
      }
    ],
    "File": "/var/www/nextcloud/lib/private/Http/Client/LocalAddressChecker.php",
    "Line": 77,
    "message": "No Nextcloud server.",
    "exception": {},
    "CustomMessage": "No Nextcloud server."
  }
}
{
  "reqId": "4rLQwonHL2kosXiJR43t",
  "level": 3,
  "time": "2023-01-16T21:53:16+00:00",
  "remoteAddr": "10.10.1.10",
  "user": "admin",
  "app": "federation",
  "method": "POST",
  "url": "/index.php/apps/federation/trusted-servers",
  "message": "No server to federate with found",
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36",
  "version": "25.0.2.3",
  "exception": {
    "Exception": "OCP\\HintException",
    "Message": "No server to federate with found",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/nextcloud/apps/federation/lib/Controller/SettingsController.php",
        "line": 55,
        "function": "checkServer",
        "class": "OCA\\Federation\\Controller\\SettingsController",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 225,
        "function": "addServer",
        "class": "OCA\\Federation\\Controller\\SettingsController",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 133,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
        "line": 172,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Route/Router.php",
        "line": 298,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud/lib/base.php",
        "line": 1047,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/index.php",
        "line": 36,
        "function": "handleRequest",
        "class": "OC",
        "type": "::"
      }
    ],
    "File": "/var/www/nextcloud/apps/federation/lib/Controller/SettingsController.php",
    "Line": 91,
    "Hint": "No server to federate with found",
    "message": "No server to federate with found",
    "exception": {},
    "CustomMessage": "No server to federate with found"
  }
}

config.php:

<?php
$CONFIG = array (
  'passwordsalt' => 'xxxxxxxx',
  'secret' => 'xxxxxxx',
  'trusted_domains' =>
  array (
    0 => 'localhost',
    1 => 'nextcloud.server1.com',
    2 => 'nextcloud.server2.com',
  ),
  'datadirectory' => '/owncloud/data',
  'dbtype' => 'mysql',
  'version' => '25.0.2.3',
  'overwrite.cli.url' => 'https://nextcloud.server1.com',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'xxxxxxx',
  'dbpassword' => 'xxxxxxx',
  'installed' => true,
  'instanceid' => 'xxxxxxxx',
  'maintenance' => false,
  'loglevel' => 2,
  'filelocking.enabled' => true,
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => 'localhost',
    'port' => 6379,
  ),
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
  'mail_smtpmode' => 'smtp',
  'mail_smtphost' => 'mail.mydomane.com',
  'mail_sendmailmode' => 'smtp',
  'mail_smtpport' => '25',
  'mail_from_address' => 'nextcloud',
  'mail_domain' => 'notify-service.info',
);

Hello @slava .
Fresh installation and same problem here with:
NC25.0.3
Ubuntu 22.04.2
PHP 8.1
App Federation 1.15.0

Please, can anyone help us?

Thanks