Issue opening documents in an external IP

Good evening,
I have been working with my Nextcloud server installed on a VM with Ubuntu Server 20.04 LTS and apache2, php8.1 & mariadb. The server works perfectly if I access through the local IP (https://192.168.12.150/) even if I access through an external domain https://******.com/.
The issue comes when I want to edit a document in the external domain, an error comes out: Document loading failed. Failed to load Nextcloud Office. (This doesn’t ocurrs if I access through the local IP).
I have installed Collabora Online - Built-in CODE Server & Nextcloud Office using the Use built-in CODE (Collabora Online Development Edition) and sometimes an error tells that it is not possible to establish connection with the server but after some minutes the server works again properly and appears the green check.

Please use the search - lot of issues have been discussed already

you will find the answers in this guide Nextcloud Collabora integration

I have used it but i don’t find a solution related with my problem even if I use the wiki related in the guide.

The problem comes that when I use my own server for Nextcloud Office in my domain.com I obtain this error.
image
However, if I change the URL of the server for my local IP the server seems to work (as you can see in the screenshot) but after refreshing the page, it returns to my domain ip and gives out an error.
image

the problem is Nextcloud can’t access COOL server using domain name…use the guide to understand why it is a problem