Cloud Computing Insider Awards 2022: Vote for ONLYOFFICE
Vote for ONLYOFFICE

Unable to Use OnlyOffice with Nextcloud

I am no longer able to use OnlyOffice with my Nextcloud instance. The issue began after enabling HTTPS for both services. NGINX Proxy Manger was used for reverse proxy and HTTPS. They are hosted locally, via Docker+Compose, on the same network. I can provide compose (yaml) files, logs, error messages, and other details upon request. May need help finding some of them, but I will do what I can. Screenshots available upon request.

Document Server version: 7.1.1.23
Connector version: 7.3.4
DMS (platform) version: ??
Docker Host OS: Arch-based (rolling release)
Nextcloud version: 23.0
Client OS: Windows 10 Pro 21H2

Error Message: Error when trying to connect (Error occurred in the document service: Error while downloading the document file to be converted.) (version 7.1.1.23)

Hello,
Please provide Document Server logs from /var/log/onlyoffice/documentserver/ (path inside the container).

The logs from that folder are very large. I’m not sure how to attach them here. The Nextcloud instance is sitting behind a VPN, so I can’t share them with you from the instance I’m hosting.

More info:

Would you like for me to pull a specific file from one of the folders, if applicable?

Hi, there must be something wrong with your Document Server container because the log folder must not have such a giant size. Please reproduce the issue with saving the connector settings and provide the output of tail -20 /srv/onlyoffice/logs/documentserver/converter/out.log

Here are the results of the tail command you requested:


➜  ~ tail -25 /srv/onlyoffice/logs/documentserver/converter/out.log
    at Request.emit (events.js:400:28)
    at Request.onRequestResponse (/snapshot/server/build/server/Common/node_modules/request/request.js:1059:10)
    at ClientRequest.emit (events.js:400:28)
    at HTTPParser.parserOnIncomingClient (_http_client.js:647:27)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:126:17)
    at TLSSocket.socketOnData (_http_client.js:515:22)
    at TLSSocket.emit (events.js:400:28)
    at addChunk (internal/streams/readable.js:290:12)
    at readableAddChunk (internal/streams/readable.js:265:9)
    at TLSSocket.Readable.push (internal/streams/readable.js:204:10)
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:188:23)
[2022-06-15T23:41:04.954] [ERROR] nodeJS - error downloadFile:url=https://cloud.txp-network.ml/apps/onlyoffice/empty?doc=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhY3Rpb24iOiJlbXB0eSJ9.bJ2t7gW_WS2fxz5y41YqbzaXU56MfQfEDGF1ZbLcbHg;attempt=3;code:undefined;connect:undefined;(id=conv_check_302951734_docx)
Error: Error response: statusCode:403; headers:{"server":"openresty","date":"Wed, 15 Jun 2022 23:41:04 GMT","content-type":"application/json; charset=utf-8","content-length":"27","connection":"keep-alive","referrer-policy":"no-referrer","x-content-type-options":"nosniff","x-download-options":"noopen","x-frame-options":"SAMEORIGIN","x-permitted-cross-domain-policies":"none","x-robots-tag":"none","x-xss-protection":"1; mode=block","x-powered-by":"PHP/8.0.19","set-cookie":["oc4cibqapg7s=6c23616ef3b76f304c48fec09a8c4f32; path=/; secure; HttpOnly; SameSite=Lax","oc_sessionPassphrase=xvx5ef8lpgK4hiKa5s%2BNBcKArAupvpCxuNjLsMw0rt8emnOdIFfxw3wCC2HnwMvk0iOguRIx0YFQGlh8IaGaBmxcTiMj5vAy1nXQTyAwDQ%2Bg09AsloxO9vp1RLB1ve9%2B; path=/; secure; HttpOnly; SameSite=Lax","oc4cibqapg7s=37a0c69ca2516f6ccf34330a162d4cf4; path=/; secure; HttpOnly; SameSite=Lax","__Host-nc_sameSiteCookielax=true; path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=lax","__Host-nc_sameSiteCookiestrict=true; path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=strict"],"expires":"Thu, 19 Nov 1981 08:52:00 GMT","cache-control":"no-cache, no-store, must-revalidate","pragma":"no-cache","content-security-policy":"default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none'","feature-policy":"autoplay 'none';camera 'none';fullscreen 'none';geolocation 'none';microphone 'none';payment 'none'","strict-transport-security":"max-age=63072000; preload"};
    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:1059:10)
    at ClientRequest.emit (events.js:400:28)
    at HTTPParser.parserOnIncomingClient (_http_client.js:647:27)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:126:17)
    at TLSSocket.socketOnData (_http_client.js:515:22)
    at TLSSocket.emit (events.js:400:28)
    at addChunk (internal/streams/readable.js:290:12)
    at readableAddChunk (internal/streams/readable.js:265:9)
    at TLSSocket.Readable.push (internal/streams/readable.js:204:10)
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:188:23)

The Nextcloud and OnlyOffice instances have their own subdomains - cloud.domain.suffix and docs.domain.suffix respectively.

Here is a censored version of my compose file:

version: '3'
services:
    onlyoffice-docs:
        image: onlyoffice/documentserver-ee:latest
        container_name: onlyoffice-docs
        restart: always
        volumes:
            - /srv/onlyoffice/logs:/var/log/onlyoffice
            - /srv/onlyoffice/certs:/var/www/onlyoffice/Data
            - /srv/onlyoffice/fcache:/var/lib/onlyoffice
            - /srv/onlyoffice/db:/var/lib/postgresql
            - /srv/onlyoffice/rabbitmq:/var/lib/rabbitmq
            - /srv/onlyoffice/redis:/var/lib/redis

        ports:
            - "83:80"
            - "444:443"
        environment:
            JWT_ENABLED: 'true'
            JWT_SECRET: 'SuperSecretPasskeyThatNoOneKnows' (replaced)
            JWT_HEADER: 'AuthorizationJwt'
            JWT_IN_BODY: 'true'
            USE_UNAUTHORIZED_STORAGE: 'true'
        networks:
            docker_files_Docker_Ten:
                ipv4_address: 0.0.0.0 (replaced)

networks:
    docker_files_Docker_Ten:
        external: true

Is port “444:443” the one that the document server uses? Just curious…

Hello,
You need to add this jwt header to Nextcloud configuration as well. Open the config.php file of your Nextcloud and add this section:

'onlyoffice' =>
  array (
    "jwt_header" => "AuthorizationJwt"
)

After that try saving the connector settings again.

Yes, this means external port 444 is mapped to port 443 inside the container.

I’d also recommend checking out our compose example for NC+DS:

1 Like

After adding the AthorizationJwt snipped to the Nextcloud config, settings saved successfully. Testing Nextcloud now…

Everything appears to work after modifying the Nextcloud config as you suggested. Currently testing out a few more items to ensure functionality.

That’s good news. To ensure the document saving works correctly, you can do the following:

  1. Open any document.
  2. Type something.
  3. Close it and wait till ‘seconds ago’ caption appears in the Modified column. It should take ~10 sec.
  4. Download this file and open it locally.

If all changes added are present in the file, saving works correctly and there are no connectivity issues between DS and NC.

1 Like

Sorry that I’ve taken so long to get back to you. I’ll have that done in a few hours. Everything appears to work well so far!