Nextcloud + Collabora without NAT Loopback?

I recently went about the process of integrating Collabora w/ my apache hosted Nextcloud setup. After 3 days of troubleshooting a connection issue, I remembered that Xfinity’s routers no longer allow for Nat Loopback. This means I must use something pointing to a local ip in order for Collabora to work. Usually this would be fine for personal use, but I require the Collabora setup for a group project.

Is there anyway I can work around this? I can get the suite to work by having hosts file point my 2 sub domains to the server’s local ip. However, Collabora seems to serve a local ip back when it’s time to load a document.

Nextcloud Config

 <IfModule mod_ssl.c>
Alias /nextcloud "/var/www/nextcloud/"

<VirtualHost *:443>
  DocumentRoot /var/www/nextcloud/
SSLEngine On
SSLCertificateFile /etc/letsencrypt/~~~
SSLCertificateKeyFile /etc/letsencrypt/~~~
Include /etc/letsencrypt/options-ssl-apache.conf

<Directory /var/www/nextcloud/>
  Options +FollowSymlinks
  AllowOverride All
  Allow from all

<IfModule mod_dav.c>
  Dav off

 SetEnv HOME /var/www/nextcloud
 SetEnv HTTP_HOME /var/www/nextcloud


Office Config

<VirtualHost *:443>

  # SSL configuration, you may want to take the easy route instead and use Lets Encrypt!
  SSLEngine on
  SSLCertificateFile /etc/letsencrypt/~~~
  SSLCertificateChainFile /etc/letse~~~
  SSLCertificateKeyFile /etc/letsencrypt/~~
  SSLProtocol             all -SSLv2 -SSLv3
  SSLHonorCipherOrder     on

  # Encoded slashes need to be allowed
  AllowEncodedSlashes On

  # Container uses a unique non-signed certificate
  SSLProxyEngine On
  SSLProxyVerify None
  SSLProxyCheckPeerCN Off
  SSLProxyCheckPeerName Off

  # keep the host
  ProxyPreserveHost On

  # static html, js, images, etc. served from loolwsd
  # loleaflet is the client part of LibreOffice Online
  ProxyPass           /loleaflet retry=0
  ProxyPassReverse    /loleaflet

  # WOPI discovery URL
  ProxyPass           /hosting/discovery retry=0
  ProxyPassReverse    /hosting/discovery

  # Main websocket
  ProxyPass   /lool/ws      wss://

  # Admin Console websocket
  ProxyPass   /lool/adminws wss://

  # Download as, Fullscreen presentation and Image upload operations
  ProxyPass           /lool
  ProxyPassReverse    /lool


Note: Freedns points to my domains public IP

This is a DNS issue. The domain that you try to connect is returning your external IP. In order to be able to reach your Apache server, your DNS server has to reply with the local IP.

What can you do? The easiest solution is the modify your host file. This will solve the problem on your local computer. If you want to solve it in a more generic way, you need to setup your own DNS and redirect the domain to local IP. You might then share this custom DNS with your custom DHCP.

DNS and DHCP configuration is not really complex, presupposed you are working with IPv4 and your router allows custom DNS rules. Both points were not given in my case. I have a consumer router at home that I cannot get rid of due to several reasons. If this is also the case for you, you might disable the DHCP on your router and use a computer or semi professional router instead. Don’t forget that you might flash other firmwares on certain routers. My Linksys E2500 is supported by TomatoUSB. It turned my old rig into something really capable (e.g. custom DHCPv4 and DNSv4).

Good luck.