sorry for late reply I just found your post today.
It’s hard to say why your NC doesn’t reach CODE server as didn’t add any useful logs and configs (Nextcloud, reverse proxy, CODE), please double check
https://docs.nextcloud.com/server/latest/admin_manual/office/troubleshooting.html
it shows basic troubleshooting steps for each involved component. used curl commands show issues like DNS or certificate issues in deeper details than you see in Web UI of Nextcloud…
here you will find some more references what others experience in similar setups.