How to connect seamlessly from lan AND from internet

I have setup nextcloud on a ubos odroid at home. so I can access next cloud at home at 192.x.y.z. (that does not work when I am not at home of course).
I have setup dyndsn, so I can access next cloud when I am away at my.dyndns.com (that does not work when connected to my lan at home)

Now how I explain to nextcloud client to use 192.x.y.z when at home and to use my.dyndns.com while away ?
If not possible then how people seamlessly connect to a nextcloud home server independently of their location ?

Hi @acapola !
To access to your nextcloud with your domain at you home, you have to configure DNS on your router to redirect all request on your domain to your server.
Maybe you have an option named DMZ on your router interface, if yes set your server in this DMZ.

Thanks for the hints. I found out that my internet box does not allow to redirect domains with dots, it does have a DMZ but adding ubos there did not change. I am now setting up a router behind the internet box, hopefully it will work.
Would it be technically possible that nextcloud client sort out that kind of situation, avoiding the complex setup that I am trying to achieve entirely ? (I am not good at networking, but coding I can do, once the task is clear)

You need to set up split horizon DNS on a local DNS server for this to work fluidly and reliably. The end result of this is the FQDN resolves to the LAN IP while on your LAN, and the public IP otherwise.