Office online works only with nextcloud server ubuntu 20+ without certifiacte

I am using nextcloud version
ubuntu 18
postgress database

php 7.4

officeonline works well

when using ubuntu version higher than 18 like 20 or 21
officeonline works only with nextcloud http url and when using my nextcloud server https url I have this error when try to open office file Screenshot from 2021-04-19 18-07-18 but with the same file when open my nextcloud server using http url it is opened and editable. this proplem doesn’t exist when using ubuntu version 18