Issue with Federation and Shares

Background
Server2 was live for 3 years and then in the process of updating from an older version the database became corrupt. I migrated everything to Server1 and completely rebuilt Server2. I’m looking to have federated servers in 3 regions with shares so that files are publicly available across those 3 regions. My use is too small to consider enterprise as this is just for some filesharing for a game.

Nextcloud version: 22.0.0
Operating system and version: Ubuntu 20.04
Apache or nginx version: Apache 2.4..41
PHP version: 7.4

The issue you are facing:
Server1 can add Server2 but Server2 cannot add Server1 as a Trusted server. When attempting to create federated shares via username@domain.com I can create it from Server1 to Server2. But, not the other direction.

The share that is created shows up and I can accepted it. But if I try to view the contents I get an error:

File not found
The document could not be found on the server. Maybe the share was deleted or has expired?

Link:https://server1.domain.com/remote.php/webdav/filename

Is this the first time you’ve seen this error?: Yes

Steps to replicate it:

  1. Created 2 servers
  2. Add each as a trusted server.
  3. Attempt to create a federated share.

Server1 Admin Logs

InvalidArgumentException: Invalid Federated Cloud ID
OC\HintException: No server to federate with found

Server2 Admin Logs

OC\HintException: No server to federate with found
OCP\Files\StorageNotAvailableException: Sabre\HTTP\ClientException: SSL certificate problem: unable to get local issuer certificate
Could not detect any host in subdomain.domain.net/status.php

CONFIG.PHP Server 1

<?php
$CONFIG = array (
  'instanceid' => 'XXXXXXXXXXX',
  'passwordsalt' => 'XXXXXXXXXXXXX',
  'secret' => 'XXXXXXXXXXX',
  'trusted_domains' =>
  array (
    0 => 'primary1.domain.net',
    1 => 'primary2.domain.com',
    2 => 'localhost',
  ),
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '22.0.0.11',
  'overwrite.cli.url' => 'https://primary1.domain.net',
  'htaccess.RewriteBase' => '/',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'user',
  'dbpassword' => 'password',
  'installed' => true,
);

CONFIG.PHP Server 2

<?php
$CONFIG = array (
  'instanceid' => 'XXXXXXXXX',
  'passwordsalt' => 'XXXXXXXXXXX',
  'secret' => 'XXXXXXXXXXXXX',
  'trusted_domains' =>
  array (
    0 => 'primary2.domain.com',
    1 => 'secondary2.domain.com',
    2 => 'primary1.domain.net',
    3 => 'localhost',
  ),
  'datadirectory' => '/var/www/html/nextcloud/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '22.0.0.11',
  'overwrite.cli.url' => 'https://primary.domain.com',
  'htaccess.RewriteBase' => '/',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'user',
  'dbpassword' => 'password',
  'installed' => true,
  'app_install_overwrite' =>
  array (
    0 => 'occweb',
  ),
  'maintenance' => false,
);

SERVER1 Apache Log

[Wed Jul 28 06:38:33.301418 2021] [access_compat:error] [pid 91911] [client MyIP:19356] AH01797: client denied by server configuration: /var/www/nextcloud/data/.ocdata

SERVER2 Apache Log

[Tue Jul 27 17:52:24.280521 2021] [access_compat:error] [pid 16559] [client RandomPublicIP:40374] AH01797: client denied by server configuration: /var/www/html/nextcloud/nextcloud/config/getuser
[Wed Jul 28 00:40:34.182107 2021] [access_compat:error] [pid 10158] [client MyIP:19446] AH01797: client denied by server configuration: /var/www/html/nextcloud/nextcloud/data/.ocdata

Still waiting for a reply to this.

Is this a cut-and-paste or modify error?
Server 1:

Server 2:

Another hint.
In the gui administrator configuration you can configure some sharing options.