CODE behind reverse proxy (apache) not using FQDN for loading scripts

Hi all,

I moved my working NC instance behind an apache reverse proxy. Domain stayed the same. I put the overwritehost, overwriteprotocol and overwrite.cli.url in config.php. Everything works fine, including notify_push (that was another story :-))

However: Editing a document, Nextcloudoffice (with built-in CODE) starts to load but fails. In the browser console I can see that it tries to load scripts from the internal server name instead of the FQDN; ie from https://servername/ā€¦ instead of https://mydomain.com/ā€¦

My apache proxy config is:

<VirtualHost *:443>

        ServerName mydomain.com
        ServerAdmin admin@mydomain.com

        Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"

        Include /etc/letsencrypt/options-ssl-apache.conf
        SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1

        SSLProxyEngine on
        SSLProxyVerify none
        SSLProxyCheckPeerCN off
        SSLProxyCheckPeerName off
        SSLProxyCheckPeerExpire off

        RewriteEngine On
        RewriteRule ^/\.well-known/carddav https://%{SERVER_NAME}/nextcloud/remote.php/dav/ [R=301,L]
        RewriteRule ^/\.well-known/caldav https://%{SERVER_NAME}/nextcloud/remote.php/dav/ [R=301,L]
	RewriteRule ^/\.well-known/webfinger https://%{SERVER_NAME}/nextcloud/public.php?service=webfinger [QSA,L]
        RewriteRule ^/\.well-known/nodeinfo https://%{SERVER_NAME}/nextcloud/index.php/.well-known/nodeinfo [R=301,L]        
	RewriteCond %{HTTP:Upgrade} websocket [NC]
	RewriteCond %{HTTP:Connection} upgrade [NC]

	ProxyPassMatch (.*)(\/websocket)$ "ws://servername/$1$2"

        ProxyPreserveHost On

	ProxyPass /push/ws ws://servername:7867/ws
	ProxyPass /push/ https://servername:7867/
        ProxyPass /.well-known !
        ProxyPass / https://servername/

        ProxyPassReverse /push/ https://servername:7867/
	ProxyPassReverse / https://servername/	
 
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
 
        SSLCertificateFile /etc/letsencrypt/live/mydomain.com/fullchain.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/mydomain.com/privkey.pem

        ProxyRequests Off
        ProxyPreserveHost Off

</VirtualHost>

any hints & ideas what Iā€™m missing?

Kind regards
el lobo