Configuring document server to communicate with Nodejs integration internally in Docker container

Do you want to: Suggest a feature / Report a bug / Ask a how-to question
For feature suggestions, describe the result you would like to achieve in detail.
For bug reports, provide the steps to reproduce and if possible a minimal demo of the problem.
Document Server version: 8.3
Type of installation of the Document Server (docker, deb/rpm, exe, please point us to the installation guide that you used as well): Docker image onlyoffice/documentserver
OS: Ubuntu 24.04.1 LTS x86_64
Browser version: Firefox v137.0 (aarch64)
Additional information:
Any relevant details about the situation. If you’ve modified configuration files or are using a proxy server that might affect the situation, please mention it. You can also attach images and videofile to the post (or to place them to external storage)

Hi! :wave:

I’ve stuck for a while now trying to integrate Onlyoffice Docs as a self-hosted solution on a cloud platform so I believe that now is the time to ask for expert assistance.

My setup

I’m using a Docker setup. Specifically, I use the onlyoffice/documentserver base image (i.e., the community-version of Onlyoffice Docs) as the back-end, and this Node.js example integration in the front-end.

One key limitation of the cloud platform I’m integrating Onlyoffice Docs on is that everything has to be contained in a single Docker container (i.e., no Docker compose etc.) with exactly one published port (the usual ports are available for communication inside the container of course). Therefore, I’ve added the Node.js example integration to the documentserver base image and deploy it from there. I publish the nginx HTTP port (80).

I’ve made only minor adjustments to the different configuration files at this point. In the document server default.json:

  • Set rejectUnauthorized to false
  • Set blockPrivateIP to false
  • Set allowPrivateIPAddress to true

In the Node.js default.json

  • Update the JWT session token to correspond to the token from the documentserver’s local.json.

Finally, I’ve set the following global environment variable: JWT_HEADER='AuthorizationJwt'.

To start the app, I first start the documentserver in the background using the /app/ds/run-document-server.sh script. Once that has started I start the Node.js integration. After this, both the /welcome and /example pages are acessible without problems, and the /healthckeck page returns true.

The issues

When I deploy the Docker container as described above, I encounter some different issues that makes the app inoperable as it is right now. I believe that the different problems may have the same root cause, but I’m not completely sure.

The two key issues are the following:

  1. It seems that the Document editor can’t communicate properly with the documentserver-side services. In particular, when I try to edit a document, I get the different error messages in the interface. Specifically, I get a ‘Could not be saved’ error pop-up immediately followed by a ‘Download failed’ pop-up.
  2. It furthermore seems that Onlyoffice wants to communicate via an IP address (denoted <internal_IP> in the attached log-files) on our internal network that it’s not (and will not be) allowed to use. We’ve made an exception specifically for this app in our development system, but this won’t be possible in production. Before making this exception, whenever the document editor was opened it would be stuck on Loading document until it failed due to a timeout error.

To me, the underlying issue seems to be that the Node.js integration and the documentserver somehow communicate with each other over the external network instead of internally in the Docker container.

As an aside, I’ve also tried deploying the example integration that comes with the documentserver (i.e., documentserver-example) instead of the Node.js integration which resulted in the same behavior.

The documentserver out.log shows the following (with some info redacted):

[2025-04-04T09:29:10.960] [WARN] [localhost] [docId] [userId] nodeJS - Express server starting...
[2025-04-04T09:29:10.970] [WARN] [localhost] [docId] [userId] nodeJS - notifyLicenseExpiration(): expiration date is not defined
[2025-04-04T09:29:10.971] [WARN] [localhost] [docId] [userId] nodeJS - notifyLicenseExpiration(): expiration date is not defined
[2025-04-04T09:29:11.203] [WARN] [localhost] [docId] [userId] nodeJS - Express server listening on port 8000 in production-linux mode. Version: 8.3.2. Build: 19
[2025-04-04T09:29:56.989] [WARN] [localhost] [docId] [userId] nodeJS - Express server starting...
[2025-04-04T09:29:56.996] [WARN] [localhost] [docId] [userId] nodeJS - notifyLicenseExpiration(): expiration date is not defined
[2025-04-04T09:29:56.997] [WARN] [localhost] [docId] [userId] nodeJS - notifyLicenseExpiration(): expiration date is not defined
[2025-04-04T09:29:57.174] [WARN] [localhost] [docId] [userId] nodeJS - Express server listening on port 8000 in production-linux mode. Version: 8.3.2. Build: 19
[2025-04-04T09:37:31.961] [ERROR] [localhost] [<IP_1>__<IP_2>__<internal-IP>new.docx1743752251128] [uid-1] nodeJS - postData error: url = http:/<interface-URL>/example/track?filename=new.docx&useraddress=<IP_1>__<IP_2>__<internal-IP>;data = {"key":"<IP_>__<IP_2>__<internal-IP>new.docx<some-integer-code>","status":1,"users":["uid-1"],"actions":[{"type":1,"userid":"uid-1"}],"token":"<token>"} Error: Error response: statusCode:301; headers:{"server":"nginx","date":"Fri, 04 Apr 2025 07:37:31 GMT","content-type":"text/html","content-length":"162","connection":"keep-alive","location":"https://<interface-URL>/example/track?filename=new.docx&useraddress=<IP_1>__<IP_2>__<internal-IP>"}; body:
<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx</center>
</body>
</html>

    at Request._callback (/snapshot/server/Common/sources/utils.js)
    at Request.callback (/snapshot/server/Common/node_modules/request/request.js:185:22)
    at Request.emit (node:events:527:28)
    at Request.<anonymous> (/snapshot/server/Common/node_modules/request/request.js:1161:10)
    at Request.emit (node:events:527:28)
    at IncomingMessage.<anonymous> (/snapshot/server/Common/node_modules/request/request.js:1083:12)
    at Object.onceWrapper (node:events:641:28)
    at IncomingMessage.emit (node:events:539:35)
    at endReadableNT (node:internal/streams/readable:1345:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)

and the nginx err.log shows the following:

2025/04/04 09:33:51 [error] 13235#13235: *2 connect() failed (111: Connection refused) while connecting to upstream, client: <internal-IP>, server: , request: "GET /example/ HTTP/1.1", upstream: "http://0.0.0.0:3000/", host: "a<interface-URL>"
2025/04/04 09:34:00 [error] 13235#13235: *11 connect() failed (111: Connection refused) while connecting to upstream, client: <internal-IP>, server: , request: "GET /example/ HTTP/1.1", upstream: "http://0.0.0.0:3000/", host: "<interface-URL>", referrer: "https://<interface-URL>/welcome/"

My main questions

My key questions relate to the point about the services communicating externally vs. internally in the Docker container. Specifically, is is possible to change the configurations related to how the Node.js integration communicates with the documentserver-side services? In particular, I would like that data is sent from the external network only to the Node.js client which, in turn, communicates with the documentserver-side services internally in the Docker container via the loopback interface (e.g., localhost)?

Can you provide a statement about whether this is possible in general? And if it’s in fact possible, would you be willing to provide me with some guidance on how to configure this?

Thanks a lot in advance!

Hello @J_whits,
We haven’t tested the above-mentioned scenario of using Node.js example within Docker container. We recommend to use Integrated Test Example instead. I see that you’ve already tried it but it didn’t work for some reason. Was it separate container where no additional Node.js example was present? Provide more details about the configuration (and full logs)

If you need us to check the scenario of Node.js example usage within the container, you can contact our colleagues via helpdesk.onlyoffice.com

Hi @DmitriiV

Thanks a lot for replying!

I’ve just re-tried running the Integrated Test Example (with everything related to Node.js example deleted from the container first) and I can confirm that it results in a similar problems as the ones reported in the OP.

I’ve collected the relevant files in a folder which is accessible here: https://www.dropbox.com/scl/fo/j56a6781fp4v5r6yzw25q/AJGzM7ERxXinPaDgacLt0JY?rlkey=4x5zc845h56ckvr40nw1c1q7t&st=gteeku48&dl=0.

In the folder, I’ve included the out.log files for the converter and docservice (the err.log files were empty). I’ve also included nginx.error.log. The log file dumps are from when the server and Integrated Example had been started, and I had tried to create a new document from the interface (see also the screenshot in the folder under screenshots/). Finally, the output from the browser console is also there.

Regarding the configuration files, I’ve added the documentserver configuration files (from /etc/onlyoffice/documentserver) to the folder linked above. I only made changed in default.json but included the other ones in case they are relevant. As mentioned in the OP, the changes in made in default.json are fairly limited. The NGINX configuration files are also included. I worked from the NGINX configuration that is distributed with the documentserver and changed a few things, including the first rewrite in ds-docservice.conf and the listening address on the upstream servers from localhost to 0.0.0.0 (didn’t make a different, though) in http-common.conf.

I think if we can resolve the issue for the Example Integration it should be sufficient for me to resolve it for the Node.js (and other custom integrations) by myself.

I really appreciate you taking the time to help with this.

Hello there,
your log.out shows a redirect (301 Moved Permanently). Somehow your nginx is configured to redirect all requests to a different address/protocol. Maybe it is redirecting you from http to https?

Usually, if you want to connect to an application/port inside the same container 127.0.0.1:<port> or localhost:<port> should work.

UPDATE:
Looking at your uploaded logs I can see now, that your requests are in fact being redirected to https when you access your service via your domain (see docservice/out.log). I would assume you have some other proxy in front of that host doing that.

EDIT:
Since you nginx-setup is configured to only listen to 0.0.0.0:80 (see the server block in your ds.conf) it would explain why you loose connection once your other proxy redirects your initial request to https. You should check that out, by either adding/extending port 443 to your ds.conf or temporarily disable the other external redirect from http to https from the other proxy managing your domain.

1 Like

I’m joining the reply above from the user @bermuda— please pay attention to what has been said in bermuda’s post.
Also, if you are using an external proxy, which one is it?
Please send us its configuration file.
I recommend trying to roll back all configuration changes to their original state and checking how the test example works in that case (you can also try a fresh installation)

Thanks @bermuda and @DmitriiV. I’ll try out your suggestions and report back what I find later today or tomorrow.

UPDATE: I’ve now tried running a completely fresh installation with no modifications to the neither the documentserver configurations nor the NGINX configuration that comes with the onlyoffice/documentserver base image. The problems reported above remain the same as far as I can tell from the errors I get.

I’ve added the logs and all configuration files of this fresh instance to the same Dropbox folder I shared earlier. These are located in the sub-folder called fresh-installation/.

Some more details about the network setup and constraints: Traffic to the published port (in this case the NGINX port 80) enters the docker container externally via the eth0 interface. All other traffic (e.g., traffic from the Integration Test Example interface to the backend services such as docserver and converter) has to happen internally in the container via the loopback interface. In this way the problems with the possible mixing of HTTP and HTTPS traffic is also avoided.

To me, it seems that the external traffic enters the container correctly (i.e., the /welcome and /example pages both open and display correctly). But it seems that the problems start to occur when the interface tries to communicate with the different services in the backend. This could, of course, simply be an issue with the NGINX configuration, but there is also the possibility that it has something to do with the way services are configured to communicate in the onlyoffice/documentserver Docker image more generally. Does it sense what I’m saying? And if so, what are your thoughts?

Hello,
you are ignoring the fact, that your are trying to run your OO-host on http, but using your domain there is an redirect to https which requires you OO-host to be listening for ongoing connections on port 443. That is why I asked you to check that first, by temporarily suspending the redirect or update your OO-configuration to accept https connections on port 443.

I see a problem here. I would check that first and go on from there, if the issue is not resolved.

1 Like