I think the problem is Apache2 on my PI does not allow direct IPs to connect and is namebased : https://superuser.com/questions/875941/accessing-a-website-through-its-ip-address-instead-of-hostname#875943

I run some other things on my PI.
I cannot access the public IP from a browser either but this is not a problem as my Duckdns.org FQDN works fine there.

When I manually sync with Davdroid it works fine, it is only the automated syncs that fail, there are notifications saying they failed.

If the automatic syncing was forced to use the namebase / FQDN; https://XXX.duckdns.org/nextcloud instead of resolving it to XX.XXX.XX.XX:443 I’m sure it would successfully work as the main activity does.

Please can you look into this.