Downloading error

Hello.
I have problem with downloading documents (-4 Error).
In my project i use OnlyOfficeEditor and OnlyOfficeConverter. OnlyOffice launched with docker.
I use MinIO for file storage. And there are 2 options in MinIO : private and public buckets. I used public bucket and all worked well. But i need to use privite bucket and i make temporary url with signature. So i pass this url to “url” param and got error -4.

data for converting

def _prepare_post_data(self, file_relative_url: str) -> dict[str, Any]:
        file_absolute_url = self._make_absolute_file_url(file_relative_url=file_relative_url)

        payload = {
            "async": True,
            "filetype": file_relative_url.split(".")[-1],
            "key": self.document_key,
            "outputtype": self._OUTPUT_TYPE,
            "url": file_absolute_url,
            "title": self._pure_file_name,
        }

        header = {
            "alg": "HS256",
            "typ": "JWT",
        }
        data = {"token": jwt.encode(payload, settings.ONLY_OFFICE_SECRET, algorithm="HS256", headers=header)}

        return data

So, this temporary url i pass into browser and got a file.
This temporary urls work in my service.
url looks like this:

public

http://10.10.10.241:9000/law-making-private-test/2024-11-28/6357cebad92c0b510c9c1b0293d7a075/%D0%9F%D0%9E%D0%A1%D0%A2%D0%90%D0%9D%D0%9E%D0%92%D0%9B%D0%95%D0%9D%D0%98%D0%95_%D0%93%D0%9E%D0%A1%D0%A1%D0%A2%D0%90%D0%9D%D0%94%D0%90%D0%A0%D0%A2%D0%90_55_%D0%9E%D0%B1_%D1%83%D1%82%D0%B2%D0%B5%D1%80%D0%B6%D0%B4%D0%B5%D0%BD%D0%B8%D0%B8_%D0%9F%D1%80%D0%B0%D0%B2%D0%B8%D0%BB_%D1%80%D0%B0%D0%B7%D1%80%D0%B0%D0%B1%D0%BE%D1%82%D0%BA%D0%B8_%D1%82%D0%B5%D1%85%D0%BD%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D1%85_%D0%BA%D0%BE%D0%B4%D0%B5%D0%BA%D1%81%D0%BE%D0%B2_%D1%83%D1%81%D1%82%D0%B0%D0%BD%D0%BE%D0%B2%D0%B8%D0%B2%D1%88%D0%B5%D0%B9%D1%81%D1%8F_%D0%BF%D1%80%D0%B0%D0%BA%D1%82%D0%B8%D0%BA%D0%B8.docx

privite

http://10.10.10.241:9000/law-making-private-test/2024-11-28/6357cebad92c0b510c9c1b0293d7a075/%D0%9F%D0%9E%D0%A1%D0%A2%D0%90%D0%9D%D0%9E%D0%92%D0%9B%D0%95%D0%9D%D0%98%D0%95_%D0%93%D0%9E%D0%A1%D0%A1%D0%A2%D0%90%D0%9D%D0%94%D0%90%D0%A0%D0%A2%D0%90_55_%D0%9E%D0%B1_%D1%83%D1%82%D0%B2%D0%B5%D1%80%D0%B6%D0%B4%D0%B5%D0%BD%D0%B8%D0%B8_%D0%9F%D1%80%D0%B0%D0%B2%D0%B8%D0%BB_%D1%80%D0%B0%D0%B7%D1%80%D0%B0%D0%B1%D0%BE%D1%82%D0%BA%D0%B8_%D1%82%D0%B5%D1%85%D0%BD%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D1%85_%D0%BA%D0%BE%D0%B4%D0%B5%D0%BA%D1%81%D0%BE%D0%B2_%D1%83%D1%81%D1%82%D0%B0%D0%BD%D0%BE%D0%B2%D0%B8%D0%B2%D1%88%D0%B5%D0%B9%D1%81%D1%8F_%D0%BF%D1%80%D0%B0%D0%BA%D1%82%D0%B8%D0%BA%D0%B8.docx?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=vokoOkG71281d0LXZ5KW%2F20241128%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20241128T114254Z&X-Amz-Expires=300&X-Amz-SignedHeaders=host&X-Amz-Signature=b9b7346964dbe3b480a20765e3a25df238f74b9f0a44a54867bf518988ea2879

So difference in query params
if i use public bucket it doesn work with temporary url also

I tried download in container

docker exec -it[id] bash
curl '[url]' --output test.docx 

and i got a file inside OnlyOffice container with temporary url
i also tried with .txt files, so i am sure that i realy got file, i saw it with nano.
So, why i can get file inside container with curl, but i got -4 Error?
Thanks for your help.

Hello @belevich00,

Could you send the Document Server logs as an archive? They are located in the directory /var/log/onlyoffice/documentserver/ inside the Docker container.

i cant attach archive here. If you give me way how to send i will do it.
docker logs when i trying to open document in editor

==> /var/log/onlyoffice/documentserver/converter/out.log <==
[2024-12-04T11:32:48.905] [ERROR] [localhost] [76a11b2c-963e-4143-b771-b9f41f45c8da] [205] nodeJS - error downloadFile:url=http://10.10.10.241:9000/law-making-private-test/2024-12-4/only-office/1928b54c555ae56433bd7fd56f471a69/%D0%93%D0%BE%D1%81%D1%83%D0%B4%D0%B0%D1%80%D1%81%D1%82%D0%B2%D0%B5%D0%BD%D0%BD%D1%8B%D0%B5_%D1%86%D0%B8%D1%84%D1%80%D0%BE%D0%B2%D1%8B%D0%B5_%D0%BF%D0%BB%D0%B0%D1%82%D1%84%D0%BE%D1%80%D0%BC%D1%8B_GDP.docx?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=vokoOkG71281d0LXZ5KW%2F20241204%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20241204T113248Z&X-Amz-Expires=300&X-Amz-SignedHeaders=host&X-Amz-Signature=9a15a6d92cb5160d3935281d305e7278f15485b74977bdfef4af67671d9dd928;attempt=1;code:null;connect:null Error: Error response: statusCode:400; headers:{"accept-ranges":"bytes","content-length":"471","content-type":"application/xml","server":"MinIO","strict-transport-security":"max-age=31536000; includeSubDomains","vary":"Origin","x-amz-id-2":"dd9025bab4ad464b049177c95eb6ebf374d3b3fd1af9251148b658df7ac2e3e8","x-amz-request-id":"180DF607CFC01593","x-content-type-options":"nosniff","x-xss-protection":"1; mode=block","date":"Wed, 04 Dec 2024 11:32:25 GMT"};
    at Request.fResponse (/snapshot/server/Common/sources/utils.js)
    at Request.emit (node:events:527:28)
    at Request.onRequestResponse (/snapshot/server/Common/node_modules/request/request.js:1066:10)
    at ClientRequest.emit (node:events:527:28)
    at HTTPParser.parserOnIncomingClient (node:_http_client:631:27)
    at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17)
    at Socket.socketOnData (node:_http_client:494:22)
    at Socket.emit (node:events:527:28)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at Socket.Readable.push (node:internal/streams/readable:228:10)
    at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
[2024-12-04T11:32:49.917] [ERROR] [localhost] [76a11b2c-963e-4143-b771-b9f41f45c8da] [205] nodeJS - error downloadFile:url=http://10.10.10.241:9000/law-making-private-test/2024-12-4/only-office/1928b54c555ae56433bd7fd56f471a69/%D0%93%D0%BE%D1%81%D1%83%D0%B4%D0%B0%D1%80%D1%81%D1%82%D0%B2%D0%B5%D0%BD%D0%BD%D1%8B%D0%B5_%D1%86%D0%B8%D1%84%D1%80%D0%BE%D0%B2%D1%8B%D0%B5_%D0%BF%D0%BB%D0%B0%D1%82%D1%84%D0%BE%D1%80%D0%BC%D1%8B_GDP.docx?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=vokoOkG71281d0LXZ5KW%2F20241204%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20241204T113248Z&X-Amz-Expires=300&X-Amz-SignedHeaders=host&X-Amz-Signature=9a15a6d92cb5160d3935281d305e7278f15485b74977bdfef4af67671d9dd928;attempt=2;code:null;connect:null Error: Error response: statusCode:400; headers:{"accept-ranges":"bytes","content-length":"471","content-type":"application/xml","server":"MinIO","strict-transport-security":"max-age=31536000; includeSubDomains","vary":"Origin","x-amz-id-2":"dd9025bab4ad464b049177c95eb6ebf374d3b3fd1af9251148b658df7ac2e3e8","x-amz-request-id":"180DF6080BF5FB77","x-content-type-options":"nosniff","x-xss-protection":"1; mode=block","date":"Wed, 04 Dec 2024 11:32:26 GMT"};
    at Request.fResponse (/snapshot/server/Common/sources/utils.js)
    at Request.emit (node:events:527:28)
    at Request.onRequestResponse (/snapshot/server/Common/node_modules/request/request.js:1066:10)
    at ClientRequest.emit (node:events:527:28)
    at HTTPParser.parserOnIncomingClient (node:_http_client:631:27)
    at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17)
    at Socket.socketOnData (node:_http_client:494:22)
    at Socket.emit (node:events:527:28)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at Socket.Readable.push (node:internal/streams/readable:228:10)
    at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
[2024-12-04T11:32:50.925] [ERROR] [localhost] [76a11b2c-963e-4143-b771-b9f41f45c8da] [205] nodeJS - error downloadFile:url=http://10.10.10.241:9000/law-making-private-test/2024-12-4/only-office/1928b54c555ae56433bd7fd56f471a69/%D0%93%D0%BE%D1%81%D1%83%D0%B4%D0%B0%D1%80%D1%81%D1%82%D0%B2%D0%B5%D0%BD%D0%BD%D1%8B%D0%B5_%D1%86%D0%B8%D1%84%D1%80%D0%BE%D0%B2%D1%8B%D0%B5_%D0%BF%D0%BB%D0%B0%D1%82%D1%84%D0%BE%D1%80%D0%BC%D1%8B_GDP.docx?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=vokoOkG71281d0LXZ5KW%2F20241204%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20241204T113248Z&X-Amz-Expires=300&X-Amz-SignedHeaders=host&X-Amz-Signature=9a15a6d92cb5160d3935281d305e7278f15485b74977bdfef4af67671d9dd928;attempt=3;code:null;connect:null Error: Error response: statusCode:400; headers:{"accept-ranges":"bytes","content-length":"471","content-type":"application/xml","server":"MinIO","strict-transport-security":"max-age=31536000; includeSubDomains","vary":"Origin","x-amz-id-2":"dd9025bab4ad464b049177c95eb6ebf374d3b3fd1af9251148b658df7ac2e3e8","x-amz-request-id":"180DF6084825650D","x-content-type-options":"nosniff","x-xss-protection":"1; mode=block","date":"Wed, 04 Dec 2024 11:32:27 GMT"};
    at Request.fResponse (/snapshot/server/Common/sources/utils.js)
    at Request.emit (node:events:527:28)
    at Request.onRequestResponse (/snapshot/server/Common/node_modules/request/request.js:1066:10)
    at ClientRequest.emit (node:events:527:28)
    at HTTPParser.parserOnIncomingClient (node:_http_client:631:27)
    at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17)
    at Socket.socketOnData (node:_http_client:494:22)
    at Socket.emit (node:events:527:28)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at Socket.Readable.push (node:internal/streams/readable:228:10)
    at TCP.onStreamRead (node:internal/stream_base_commons:190:23)

Hello @belevich00,
Could you upload the archive to a file-sharing service or cloud storage and then provide a link to the archive file?

Attaching the link

Hello, @belevich00
We will review your request and inform you of the results.

Hello @belevich00,

Try changing the standard JWT header to something like AuthorizationJWT.

1.Open your container

docker exec -it  <container ID> bash
  1. Open the local.json file with any available text editor.
  • In a Docker container: /etc/onlyoffice/documentserver/local.json.
  1. Find the services.CoAuthoring.token section:
{
  "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"
        },
        "outbox": {
          "header": "Authorization"
        }
      },
      "secret": {
        "inbox": {
          "string": "string"
        },
        "outbox": {
          "string": "string"
        },
        "session": {
          "string": "string"
        }
      }
    }
  },
  "rabbitmq": {
    "url": "amqp://guest:guest@localhost"
  },
  "storage": {
    "fs": {
      "secretString": "secret-secret"
    }
  }
}
  1. Replace the header values, inbox, and outbox with “AuthorizationJWT”.

Example After Changes:

{
  "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": "AuthorizationJwt"
        },
        "outbox": {
          "header": "AuthorizationJwt"
        }
      },
      "secret": {
        "inbox": {
          "string": "string"
        },
        "outbox": {
          "string": "string"
        },
        "session": {
          "string": "string"
        }
      }
    }
  },
  "rabbitmq": {
    "url": "amqp://guest:guest@localhost"
  },
  "storage": {
    "fs": {
      "secretString": "secret-secret"
    }
  }
}
  1. Restart Document Server services to apply the changes:

in container use command:

supervisorctl restart all