I solved it by adding a new config parameter in config.php:
'overwriteprotocol' => 'https',
When generating URLs, Nextcloud attempts to detect whether the server is accessed via
httpsorhttp. However, if Nextcloud is behind a proxy and the proxy handles thehttpscalls, Nextcloud would not know thatsslis in use, which would result in incorrect URLs being generated.
Since my NC is behind a proxy, this seems to be needed since Nextcloud 17.
( I found the hint here: After Nextcloud 17 Update, I can't sync my linux client with nextcloud - #10 by Exchizz )