Proxy Issue with overwriteprotocol https in Nextcloud Settings for Collabora Online - Built-in CODE Server (/settings/user/richdocuments)

Hello,

I see an issue to configure The “Collabora Online - Built-in CODE Server” under “/settings/user/richdocuments” behind a proxy.

The Build in Server works without the reverse SSL proxy, but it is not possible to set the right the settings for the “/settings/user/richdocuments”.

If I choose “Use built in …” the Check is green and when I klick into “Use own…” it shows the right URL with https. I press the save button too. But after reload it points again to http.
It seems, that the “/settings/user/richdocuments” does not handle the “X-Forward-Forwarted-Ssl” or “X-Forward-Forwarted-Proto” header or it ignores the “‘overwriteprotocol’ => ‘https’,” setting in “/config/config.php”

If I set “SetEnv HTTPS on” in /.htaccess ist works like a charm.

That means, the “/custom_apps/richdocumentscode/proxy.php” is not affected . Only the configuration of the built in Collabora inside Nextcloud fails at the http isntead of https.
The hostname as set in ‘overwritehost’ works.

nginx config:

server {
    listen 443 ssl;
    server_name example.com;
    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;

    location /  {
        proxy_pass http://192.168.2.30:8080/;

        # collabora server websocket
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_set_header Host "example.com";
        proxy_set_header X-Forwarded-Proto "https";
    }

}

config.php


  'overwritehost' => 'example.com',
  'overwriteprotocol' => 'https',
  'overwritecondaddr' => '^192\\.168\\.0\\.100$',

I have the exact same issue here on NC 23.0.2.

My browsers console gives me this error:
Mixed Content: The page at 'https://nextcloud.XXXXX.com/index.php/apps/files/?dir=/&fileid=182' was loaded over HTTPS, but requested an insecure form action 'http://xxxx.XXX,.XXX.XXX/apps/richdocumentscode/proxy.php?req=/browser/e8ac597/cool.html?WOPISrc=https%3A%2F%2Fnextcloud.project-ivo.com%2Findex.php%2Fapps%2Frichdocuments%2Fwopi%2Ffiles%2F1201709_ocqdjcfm527i&title=DOCUMENT.xlsx&lang=en&closebutton=1&revisionhistory=1'. This request has been blocked; the content must be served over HTTPS.

If I try to open a document I see the spinner and then get this error:
“Document loading failed”
“Failed to load Nextcloud Office - please try again later”

  • Collabora Online - Built-in CODE Server 21.11.204
  • Nextcloud Office 5.0.3

This is your workaround?

Yes, it is:

adding the line SetEnv HTTPS on to .htaccess

But it will removed on every update.

Hi @augustusburg

You can refer to the configuration in my article.

Use HTTPS with Ubuntu 22.04, apache, Nextcloud and Collabora(Docker)