ONLYOFFICE/onlyoffice-mattermost

Not open document in onlyoffice - Download failed

SubhashPatel opened this issue · 9 comments

Hi,

After clicking Open file in ONLYOFFICE, it cannot load a document.

Error:
Download failed
Press 'OK' to return to the document list.
Capture

Onlyoffice is run on different servers. and access via https://onlyoffice.domain.com/

The onlyoffice settings are below I have written fake details for security purposes. in real cases onlyoffice details are correct.
Capture1

onlyoffice server error log:
[2023-12-20T16:27:16.049] [ERROR] [localhost] [36fbef9366fcc77ff1735e2a2861be37] [ka978ddmupn8uc7g7s1h7gyrta] nodeJS - error downloadFile:url=https://domain.com/plugins/com.onlyoffice.mattermost/api/download?id=twezfmo49pn8upxo4wbampuqnc;attempt=1;code:null;connect:null Error: Error response: statusCode:403; headers:{"server":"nginx/1.18.0 (Ubuntu)","date":"Wed, 20 Dec 2023 16:27:16 GMT","content-length":"0","connection":"keep-alive"}; at Request.fResponse (/snapshot/server/build/server/Common/sources/utils.js) at Request.emit (events.js:400:28) at Request.onRequestResponse (/snapshot/server/build/server/Common/node_modules/request/request.js:1066:10) at ClientRequest.emit (events.js:400:28) at HTTPParser.parserOnIncomingClient (_http_client.js:647:27) at HTTPParser.parserOnHeadersComplete (_http_common.js:127:17) at HTTPParser.execute (<anonymous>) at TLSSocket.socketOnData (_http_client.js:515:22) at TLSSocket.emit (events.js:400:28) at addChunk (internal/streams/readable.js:293:12) at readableAddChunk (internal/streams/readable.js:267:9) at TLSSocket.Readable.push (internal/streams/readable.js:206:10) at TLSWrap.onStreamRead (internal/stream_base_commons.js:188:23)

I am also getting the exact same error, is there any fix/workaround for this issue?

I have not got a solution yet.

I found the issue - JWT_HEADER must be set to a value that is not Authorization, as stated here:

  • JWT Header: If JWT protection is enabled, it is necessary to specify a custom header name since the Mattermost security policy blocks external 'Authorization' Headers. This header should be specified in the ONLYOFFICE Docs signature settings as well (further information can be found here).

Reference: https://github.com/ONLYOFFICE/onlyoffice-mattermost?tab=readme-ov-file#plugin-settings

Ensure that this value is not Authorization, and that it is the same for both the OnlyOffice Mattermost plugin settings and the OnlyOffice documentserver settings.

@TheMythologist what do I need to change in my plugin settings? current settings I have attached in my questions.
Can you guide me?

On your OnlyOffice document server, what it is the JWT_HEADER settings used to? It needs to be set to AuthorizationJWT, as shown from your screenshot.

below is my onlyoffice local.json file

{ "services": { "CoAuthoring": { "sql": { "type": "postgres", "dbHost": "localhost", "dbPort": "5432", "dbName": "onlyoffice", "dbUser": "onlyoffice", "dbPass": "onlyoffice" }, "token": { "enable": { "request": { "inbox": true, "outbox": true }, "browser": true }, "inbox": { "header": "Authorization", "inBody": false }, "outbox": { "header": "Authorization", "inBody": false } }, "secret": { "inbox": { "string": "qIGHV0xa8o1MTPSgOTFJusf8pFTmixgn" }, "outbox": { "string": "qIGHV0xa8o1MTPSgOTFJusf8pFTmixgn" }, "session": { "string": "qIGHV0xa8o1MTPSgOTFJusf8pFTmixgn" } } } }, "rabbitmq": { "url": "amqp://guest:guest@localhost" }, "storage": { "fs": { "secretString": "94EoQuvEZvrlWo61vhTl" } } }

Are you using Docker to run your OnlyOffice document server? I'm afraid I'm not too sure on how to configure JWT_HEADER using the configuration json files. For me, I ran OnlyOffice document server via Docker, so I just have to specify JWT_HEADER=<custom_jwt_header> in my environment.

https://helpcenter.onlyoffice.com/installation/docs-enterprise-install-docker.aspx

@TheMythologist thanks it is working

we have passed parameter JWT_HEADER=AuthorizationJWT and restarted onlyoffice docker and solved issues.