Nextcloud Redirecting to Wrong URL / Wrong Port

I just manually installed NextCloud 20.0.5.2 on a local machine running Ubuntu 20.04 LTS, at /var/www/html/nextcloud . I have everything setup and working well with a self-signed OpenSSL certificate for my development LAMP.

My problem is that while logged in, if I click the nextcloud logo in top left corner, to return to the dashboard. (When I mouseover the logo, I actually see the correct https url )

I am instead redirected to the http NOT the https url for the nextcloud dashboard, resulting in an internal server error. INCORRECTLY, stating that I am trying to access myncsite< .com> on Port 80

NOTE: the same error occurs when I logout of nextcloud via the upper right menu… The error also happens when I login… requiring me to manually enter https at the beginning of the url in order to reach the dashboard

In reality, my nextcloud site is located at <h ttps://>myncsite<.com> on Port 443

My nextcloud.conf file also says <VirtualHost *:443>

And in my /var/www/html/nextcloud/config/config.php file I have the following options set:

‘trusted_domains’ =>
array (
0 => ‘127.0.0.1’,
1 => ‘myncsite<.com>’,
2 => ‘<h ttps://>myncsite<.com>’,
),

‘overwrite.cli.url’ => ‘<h ttps://>myncsite<.com>/’,

How do I get Nextcloud to remain on the correct https url and port?

Thx

I’m using this 2 variables in my config:
OVERWRITEHOST OVERWRITEPROTOCOL=https
I see no issues so far. See https://docs.nextcloud.com/server/stable/admin_manual/configuration_server/reverse_proxy_configuration.html for detailed explanation.

hey hey… I used ‘overwriteprotocol’ => ‘https’, and everything works like a charm now.

thx