Solved: Collabora CODE 26.04.2.2.1 (Docker) behind Nginx reverse proxy

Hello,

I would like to share my findings in case it helps someone else.

Environment

  • Ubuntu 24.04.4 LTS

- Docker Engine Community 29.6.1

- Docker Compose

- Nextcloud ( Docker image: nextcloud:34.0.1-apache)

- Collabora CODE 26.04.2.2.1 (Docker image: collabora/code:26.04.2.2.1)

- Nginx reverse proxy

Collabora configuration:

collabora:

image: collabora/code:26.04.2.2.1

environment:

cert_domain: collabora[.]example[.]com

domain: nextcloud\\.example\\.com

extra_params: --o:ssl.enable=false --o:ssl.termination=true

Nginx configuration:

location / {

proxy_pass http://collabora:9980;

}

Symptoms

--------

Nextcloud Office reported that it could not connect to the Collabora server.

Accessing the Collabora URL through nginx returned:

502 Bad Gateway

Nginx logs contained:

upstream prematurely closed connection while reading response header from upstream

Investigation

-------------

The container appeared healthy:

docker inspect collabora --format=‘{{.State.Health.Status}}’

Result:

healthy

Collabora logs showed:

Ready to accept connections on port 9980.

Network connectivity was fine:

nc -vz collabora 9980

Result:

Connected to collabora 9980

However:

curl [http] ://collabora:9980/hosting/discovery

returned:

Empty reply from server

I then tested HTTPS directly:

curl -vk [https] ://collabora:9980/hosting/discovery

This returned a valid WOPI discovery XML document and established a TLS connection using a self-signed certificate generated by Collabora.

Root Cause

----------

Although the container was configured with:

extra_params: --o:ssl.enable=false --o:ssl.termination=true

CODE 26.04.2.2.1 was still serving HTTPS on port 9980.

Because nginx was configured with:

proxy_pass [http]://collabora:9980;

there was a protocol mismatch:

Nginx (HTTP) → Collabora (HTTPS)

which caused:

- Empty reply from server

- upstream prematurely closed connection

- 502 Bad Gateway

Solution

--------

I changed the nginx upstream to HTTPS:

location / {

proxy_pass [https]://collabora:9980;

proxy_http_version 1.1;

proxy_ssl_verify off;

proxy_set_header Host $host;

proxy_set_header X-Forwarded-Proto https;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header Upgrade $http_upgrade;

proxy_set_header Connection “upgrade”;

proxy_read_timeout 3600;

proxy_connect_timeout 3600;

}

Result

------

After restarting nginx:

- [https] ://collabora.example.com/ worked correctly

- /hosting/discovery was reachable

- Nextcloud reported:

“Collabora Online server is reachable”

- Documents opened successfully in Collabora Online

One thing that confused me during troubleshooting:

CODE 26.04.2.2.1 appeared to be serving HTTPS on port 9980 even though I had configured:

--o:ssl.enable=false --o:ssl.termination=true

The issue was resolved by changing the nginx upstream from HTTP to HTTPS, so I’m wondering whether I misunderstood how these parameters are intended to work, or whether something has changed in recent releases.

Thank you.

I’m running Collabora CODE since age using docker-compose and all the time I used traefik and set extra_params=--o:ssl.enable=false --o:ssl.termination=true as described in Am I misunderstanding ssl.termination and the discovery endpoint? - #4 by darshan

the config is working up to 26.04.2.1.1 and stops working with 26.04.2.2.1.

I clearly see my ENV is valid

docker inspect -f '{{json .Config.Env}}' collabora|jq
[
  "extra_params=--o:ssl.enable=false --o:ssl.termination=true",
  "username={redacted},
  "password={redacted},
  "aliasgroup1=https://nc.mydomain.tld:443",
  "aliasgroup2=https://nc.myotherdomain.tld:443",
  "dictionaries=de_DE en_US es_ES ru",
  "PATH=/usr/bin:/bin",
  "LD_LIBRARY_PATH=/lib:/usr/lib:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu",
  "LC_CTYPE=C.UTF-8"
]

in the startup log I can see

wsd-00001-00001 2026-08-06 19:46:05.307031 [ coolwsd ] INF  SSL support: SSL is enabled.|wsd/COOLWSD.cpp:1938
wsd-00001-00001 2026-08-06 19:46:05.307040 [ coolwsd ] INF  SSL support: termination is disabled.|wsd/COOLWSD.cpp:1939

using curl I can confirm ../hosting/discovery is using https and self-signed cert.

reverting to 26.04.2.1.1 immediately makes it work :white_check_mark:

I seems with this upgrade TLS termination is broken, likely it is related to

Recent images (26.04.2.2.1 and later) are distroless: they have no shell and a minimal base. If you are upgrading from an older image, see Migrating to the distroless Docker image.

btw - new bot-protection CDN in front of the docs is terrible - it take many seconds until one can access the docs :frowning:

Update: using coolwsd.xml I could change both setting and TLS termination works..

I don’t use --o:ssl.enable=false or --o:ssl.termination=true, but I had a similar problem with --o:logging.disable_server_audit=true. That option had no effect in cp-26.04.2-2.

However, this was then fixed in cp-26.04.2-3:

Yes I confirm this is solved with 26.04.2.4.1..
it’s a shame I missed this image was shipped already 16d ago :man_facepalming: