[BUG]Webdav and Federated Cloud Bugs for NAT based Nextcloud server

Hello, I don’t know if I am the only one facing the situation like owning an NAS but didn’t have a Public IP (which means I cannot access it directly from Internet, like typing it’s IP address), but this issue is really a time-bomb.

So, I have two nextcloud servers; First one is my NAS in my home, then a VPS.

Since I don’t have a public address for the NAS, I used a reverse proxy called FRP to expose it to the Internet via the VPS, so that I can access it by dropping my request to the VPS.

Everything was running very fine until I tried to use Federated Cloud. Let’s call the VPS as vps.com and NAS as nas.vps.com below.

I created two folders on both servers, and shared them via Federated Cloud address. (Which means I shared folder on NAS to user@vps.com, and folder on VPS to nas.vps.com). It was unfortunate that only the share from VPS to NAS worked. The share from NAS to user@vps.com cannot be loaded due to “Service Unavailable”. The logs are below:

Sabre\DAV\Exception\ServiceUnavailable: Sabre\HTTP\ClientHttpException: Bad Gateway
/snap/nextcloud/29223/htdocs/3rdparty/sabre/dav/lib/DAV/Tree.php - line 78:

OCA\DAV\Connector\Sabre\Directory->getChild()

/snap/nextcloud/29223/htdocs/3rdparty/sabre/dav/lib/DAV/Server.php - line 971:

Sabre\DAV\Tree->getNodeForPath()

/snap/nextcloud/29223/htdocs/3rdparty/sabre/dav/lib/DAV/Server.php - line 1661:

Sabre\DAV\Server->getPropertiesIteratorForPath()

/snap/nextcloud/29223/htdocs/3rdparty/sabre/dav/lib/DAV/Server.php - line 1646:

Sabre\DAV\Server->writeMultiStatus()

/snap/nextcloud/29223/htdocs/3rdparty/sabre/dav/lib/DAV/CorePlugin.php - line 346:

Sabre\DAV\Server->generateMultiStatus()

/snap/nextcloud/29223/htdocs/3rdparty/sabre/event/lib/WildcardEmitterTrait.php - line 89:

Sabre\DAV\CorePlugin->httpPropFind()

/snap/nextcloud/29223/htdocs/3rdparty/sabre/dav/lib/DAV/Server.php - line 472:

Sabre\DAV\Server->emit()

/snap/nextcloud/29223/htdocs/3rdparty/sabre/dav/lib/DAV/Server.php - line 253:

Sabre\DAV\Server->invokeMethod()

/snap/nextcloud/29223/htdocs/3rdparty/sabre/dav/lib/DAV/Server.php - line 321:

Sabre\DAV\Server->start()

/snap/nextcloud/29223/htdocs/apps/dav/lib/Server.php - line 333:

Sabre\DAV\Server->exec()

/snap/nextcloud/29223/htdocs/apps/dav/appinfo/v2/remote.php - line 35:

OCA\DAV\Server->exec()

/snap/nextcloud/29223/htdocs/remote.php - line 166:

require_once("/snap/nextc ... p")

This is the first bug. I am not a developer so I have no idea what this happens…
And The second one is a bit catastrorphic…

If I access nextcloud by my NAS’s Ethernet IP address and share a folder via Federated Cloud (Or just webdav), the address of the share would be as same as the Ethernet one. Imagine what happens when my VPS try to access an alien Ethernet server’s resources?

Basically nothing, but not really. When I figured out, I tried to delete the share, it wouldn’t allow it; Also, refreshing files list from occ does not work anymore, because the Ethernet address would not be allowed.

Host 192.168.0.100 was not connected to because it violates local access rules

I had to delete user to clear the invalid dav share. Removing from occ didn’t work.

So, I think this can be fixed by determining the host address, forcing nextcloud to always use the address that exposed to Internet. But I don’t know how and need help. Please post it if you have any idea, thanks in advance!