Nextcloud with OnlyOffice integration, using custom header authorization

Hi there,

Recently, I set up Nextcloud and the OnlyOffice Document Server in my homelab. I’m using Cloudflare to access both my Nextcloud instance and the OnlyOffice Document Server.

To achieve this, I created a Zero Trust tunnel and am forwarding traffic through subdomains to the respective services.

Now, I’d like to secure my OnlyOffice Document Server. To do so, I generated a token in Cloudflare, which provided me with a client ID and matching secret.

However, when I try to access my OnlyOffice server via the domain, I am denied access. This is expected.

I then ran the following command in my terminal from a different PC:

curl -v https://domain/healthcheck -H "CF-Access-Client-Id: your-cloudflare-client-id" -H "CF-Access-Client-Secret: your-cloudflare-client-secret"

Everything works perfectly, and I get a valid response.

Now, I want to add these header credentials in the Nextcloud OnlyOffice app, but I haven’t been able to get it working. I’ve tried different syntaxes, modified the config.php file, and more, but nothing seems to work.

If anyone knows how to properly add these credentials to the header, I’d really appreciate it if you could share the solution.

Looking forward to your help. Thanks in advance!