Nextcloud slower with devices connected to my home network than outside the network

Hello! I recently successfully installed Nextcloud as a snap on my Raspberry Pi with Ubuntu Server 22.04.2 LTS. It’s connected to my router through ethernet. It goes through my private domain via Let’s Encrypt. I have the latest version of everything.

Everything works correctly, except when I’m connected to my home network. Nextcloud is very slow if using a device connected to the same router as my Raspberry Pi. You think it would be fast. However, Nextcloud is faster if I connect to it outside of my house.

Any suggestions why this is the case?

When you connect to it on your LAN, are you connecting to a public IP address? If so, try putting the LAN IP in your hosts file and see if that makes a difference.

This worked! Thanks. I was connecting to my public IP. So, I put my private IP as a trusted domain and then connected that way. Works much faster now on my home network! Are there any security risks connecting through private IP on home network?

Not really if your WiFi is secure, but ideally you want to use the URL that matches the certificate. That way your computer has verified it’a talking to the correct server before sending sensitive data.

If you have the ability to run a local DNS server, split-horizon DNS solves this problem by making the correct URL go to the LAN IP while on your LAN.

There are two main problems with NAT reflection. One is that it makes your router handle traffic that would not normally traverse it. All packets to/from Nextcloud then have to be translated and routed by the router when they could just go directly from one device to the other at layer 2. This means completely unnecessary overhead.

The other problem is many routers don’t even allow this, and many of the ones that do, don’t handle it very well. That sounds like it may be the case with yours.