Hey,
I have been facing this issue for about a day and just solved it.
I am still learning so i google and mess around with things A LOT.
But this thread helped: "Strict-Transport-Security" HTTP header (HSTS) - #8 by JoshInGeneral
add this AT THE END of your .htaccess file. It should be in your Nextcloud folder (/var/www/…/nextcloud/.htaccess)
<IfModule mod_headers.c>
Header set Strict-Transport-Security "max-age=63072000; always"
Options -Indexes
</IfModule>
run sudo systemctl restart apache2