Nextcloud load balancing using Nginx

Hi,

im installing nextcloud on 3 server, and im pointing all 3 of them to be accesed from 1 web server called cloudmain (load balancing server)
using round robin load balancing, the purpose is when some 3 of it facing a failure so there will be redirected to another service.

load balancing server
nginx installed
cloudmain.com

nextcloud server 1
apache web installed
cloud1xxx.com
trusted domain same as url

nextcloud server 2
apache web installed
cloud2xxx.com
trusted domain same as url

nextcloud server 3
apache web installed
url cloud3xxx.com
trusted domain same as url

im already tried the round robin balancing, but i have no idea when cloudmain accesed becomes
“untrusted domain” but no problem appeared when accesed from original 3 nextcloud app, need more wayout about this case please

thanks