[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:


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


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


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


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


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


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


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


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


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


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


/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 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!