Unable to log in to nc15 on own server from desktop app

Hello. I have my own home server (Debian 9) on which I have installed Nextcloud 15 as docker container using this docker-compose.yml file:

version: '2'

    image: nextcloud
      - 8089:80
      - ./ncdata:/var/www/html/data
    restart: always

Next, I configured a apache vhost with Lets encrypt ssl certificate configured like this:

<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerName cloud.DOMAIN
    ServerAlias www.cloud.DOMAIN

    ServerAdmin admin@DOMAIN

    ProxyPass "/"   "http://localhost:8089/"
    ProxyPassReverse "/"   "http://localhost:8089/"

	SSLCertificateFile /etc/letsencrypt/live/cloud.DOMAIN/fullchain.pem
	SSLCertificateKeyFile /etc/letsencrypt/live/cloud.DOMAIN/privkey.pem
	Include /etc/letsencrypt/options-ssl-apache.conf

I can successfully login and use app from browser except logoff - i’m getting redirect to URL based on localhost:8089 instead of real domain.

Also cannot connect desktop app as after providing app pasword I’m getting “cannot connect to localhost” error so i guess same redirect error happens there.

What did I wrong? Is it problem with docker configuration or proxy?

In case if somebody else has this issue: Just add this option in proxy configuration:

ProxyPreserveHost On

That’s all.