I am running Nextcloud and OnlyOffice Document server in different Portainer stacks. They are behind a Traefik docker container used as a reverse proxy.
When updating Nextcloud from one version to another i sometimes get the error below, when trying to open DOCX / XLSX files:
"The document security token is not correctly formatted. Please contact your Document Server Administrator. Press OK to return to document list"
The OnlyOffice container exposes it’s HTTP port (HTTPS is unused since Traefik takes care of that, with Let’s Encrypt certificates) on a custom port 8082. My Docker host runs on 192.168.10.1
Opening 192.168.10.1:8082 in my browser we can see the following page:
So running the command on my Docker host will output the random secret.
docker exec f0d065978594 /var/www/onlyoffice/documentserver/npm/json -f /etc/onlyoffice/documentserver/local.json 'services.CoAuthoring.secret.session.string'
Output example : 879x4eLw2sZES3cY4waB
This string needs to be copied in Nextcloud -> Administration Settings -> ONLYOFFICE -> Secret key field.
Then don’t forget to press the SAVE button, located right below.
UPDATE : to use a fixed token, under environment, set JWT_SECRET as your token.
ONLYOFFICE Docs address / ONLYOFFICE Docs address for internal requests from the server is the address that’s set in DNS for your OnlyOffice instance.
Server address for internal requests from ONLYOFFICE Docs is the DNS name for your Nextcloud server.