So I have found the solution for UNAUTHORIZED WOPI HOST, it was in the loolwsd.xml.in and loolwsd.xml settings. I did not include nextcloud.mydomain.com in there (with escaped dots, ie. nextcloud.mydomian.com, with the docker image, make sure you start the image with domain=nextcloud\.mydomain\.com, as it need to be escaped twice).
But I still cannot open a file through nextcloud, it only opens if I go straight to the direct URL in the browser. In loolwsd.log it ends with ERR Error in client request handler: Timeout| wsd/LOOLWSD.cpp1013
Any ideas?