Error on Configuring the Reverse Proxy

I have installed Collabora Online (CODE version) on our development server running Ubuntu with Apache2 for testing purposes. Both CODE and Apache2 are operating on the same server. However, we are encountering difficulties configuring the reverse proxy.
when access the collabora host url in browser, it hits error ERR_TOO_MANY_REDIRECTS.

I can access the discovery service 127.0.0.1:9980/hosting/discovery in the server

Below is Vhost configuration:

<VirtualHost *:80>
ServerName howden-efms-collabora-dev.instapol.my
ServerAlias howden-efms-collabora-dev.instapol.my
Redirect permanent / https://howden-efms-collabora-dev.instapol.my/

<VirtualHost *:443>
ServerName howden-efms-collabora-dev.instapol.my
ServerAlias howden-efms-collabora-dev.instapol.my

AllowEncodedSlashes NoDecode
SSLProxyEngine On
ProxyPreserveHost On
ProxyRequests Off

# Main Proxy
ProxyPass / http://127.0.0.1:9980/ retry=0
ProxyPassReverse / http://127.0.0.1:9980/

# WebSocket (CRITICAL)
ProxyPassMatch ^/cool/(.*)/ws$  ws://127.0.0.1:9980/cool/$1/ws

RequestHeader set X-Forwarded-Proto “https”
RequestHeader set X-Forwarded-Host “howden-efms-collabora-dev.instapol.my”

DocumentRoot /var/www/empty
<Directory /var/www/empty>
	Require all denied
 </Directory>

</VirtualHost>

Please advice and assist on this issue. Thank you.

hi @siowlee.chan

First of all welcome to community forum. It’s great that you are doing such nice progress with collabora online setup.

It is not working because your Apache config does not follow the proxy rules from the Collabora documentation.

Main reasons:

  1. Proxying / is wrong

    ProxyPass / http://127.0.0.1:9980/
    

    The docs recommend proxying only specific paths like /cool, /browser, /hosting/discovery. Proxying / can create a redirect loop → ERR_TOO_MANY_REDIRECTS.

  2. WebSocket rule order
    The /cool/.../ws WebSocket rule should appear before normal ProxyPass rules.

  3. Wrong quotes in headers

    RequestHeader set X-Forwarded-Proto “https”
    

    Smart quotes break Apache. It must be "https".

These differences from the official proxy example cause the redirect loop.

Check this document : Calc: Cell formatting options do not apply when using Collabora Office Flatpak on Linux · Issue #14884 · CollaboraOnline/online · GitHub

Thanks
Darshan

Thanks for the advice and suggestion.
Below is my proxy setting, which proxying only specific paths. However when calling https://howden-efms-collabora-dev.instapol.my/hosting/discovery , will always redirect to howden-efms-collabora-dev.instapol.my. howden-efms-collabora-dev.instapol.my is showing default ubuntu html page.

<VirtualHost \*:80>
ServerName howden-efms-collabora-dev.instapol.my
ServerAlias www.howden-efms-collabora-dev.instapol.my


# Redirect all HTTP traffic to HTTPS
Redirect permanent / https://howden-efms-collabora-dev.instapol.my/


</VirtualHost>

<VirtualHost \*:443>
ServerName howden-efms-collabora-dev.instapol.my
ServerAlias www.howden-efms-collabora-dev.instapol.my


SSLEngine on
SSLCertificateFile /etc/ssl/collabora/dev.crt
SSLCertificateKeyFile /etc/ssl/collabora/dev.key

DocumentRoot /var/www/howden-efms-collabora
<Directory /var/www/howden-efms-collabora>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

# Exclude /wopi from proxying
ProxyPass        /wopi !
ProxyPassReverse /wopi !

# Collabora reverse proxy
AllowEncodedSlashes NoDecode
ProxyPreserveHost On

ProxyPass        /browser http://127.0.0.1:9980/browser retry=0
ProxyPassReverse /browser http://127.0.0.1:9980/browser

ProxyPass        /hosting/discovery http://127.0.0.1:9980/hosting/discovery retry=0
ProxyPassReverse /hosting/discovery http://127.0.0.1:9980/hosting/discovery

ProxyPass        /hosting/capabilities http://127.0.0.1:9980/hosting/capabilities retry=0
ProxyPassReverse /hosting/capabilities http://127.0.0.1:9980/hosting/capabilities

ProxyPassMatch   "/cool/(.*)/ws$" ws://127.0.0.1:9980/cool/$1/ws nocanon
ProxyPass        /cool/adminws ws://127.0.0.1:9980/cool/adminws

ProxyPass        /cool http://127.0.0.1:9980/cool
ProxyPassReverse /cool http://127.0.0.1:9980/cool

</VirtualHost>

Hi @siowlee.chan,

Your proxy config looks fine. The redirect to the default Ubuntu page means Apache can’t reach Collabora on port 9980, so it serves from DocumentRoot instead.

Quick checks:

systemctl status coolwsd
curl -v http://127.0.0.1:9980/hosting/discovery

If curl fails — Collabora isn’t running or isn’t listening on 9980. Fix that first.

If curl works — you’re likely missing an Apache module:

a2enmod proxy proxy_http proxy_wstunnel ssl rewrite headers
systemctl restart apache2

If it still doesn’t work, add LogLevel proxy:debug in your 443 VirtualHost, restart Apache, and share the relevant lines from /var/log/apache2/error.log.

Hope that helps!

Thanks
Darshan