you could try this: How to edit config.php for Nextcloud snap even though you’re not using the snap… it should be similar
occ config:system:set session.cookie_secure --value="true"