Only office with docker integration with a frontend

Hi everyone,

I’ve started a local application using Docker that I want to integrate with a frontend. Everything seems to be working correctly on the container side:

  • The healthcheck returns true.
  • I can activate and test the example provided without any issues.

However, when I try to integrate the frontend, I get the following error in the browser console:

WebSocket connection to ‘ws://localhost:xxxx/…’ failed: Error during WebSocket handshake: Unexpected response code: 400

Hello @dessteyu

How do you integrate ONLYOFFICE Docs (Document Server) into your application? Do you have any proxy service in the environment?

Also, please specify version of Document Server that is used.

Hi @Constantine , thanks for replying.
I’ using the using last docker version.
I’m getting the configuration from my backend with fast api.
And I’m using vue3 on my frontend.

DockerFile:

Image officielle OnlyOffice DocumentServer

FROM onlyoffice/documentserver:latest

Variables d’environnement pour production

ENV NODE_ENV=production
USE_SERVICE_WORKERS=true
JWT_ENABLED=true
X_FORWARDED_PROTO=http
NGINX_WORKER_PROCESSES=1
NGINX_WORKER_CONNECTIONS=1024
ALLOW_ORIGIN=*

Copier ds.conf personnalisé pour le container

COPY ds.conf /etc/onlyoffice/documentserver/nginx/ds.conf

Exposer le port HTTP interne

EXPOSE 80

Lancement du DocumentServer

CMD [“/app/ds/run-document-server.sh”]

ds.conf:

include /etc/nginx/includes/http-common.conf;

map $http_upgrade $connection_upgrade {
default upgrade;
‘’ close;
}

server {
listen 0.0.0.0:80;
listen [::]:80 default_server;
server_tokens off;

# Configuration WebSocket
location /doc/ {
    proxy_pass http://localhost:9000;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
}

set $secure_link_secret u7Y07pFb42uVejOBmRPe;
include /etc/nginx/includes/ds-*.conf;

}

Hello @dessteyu
If you don’t mind, I will join this thread as well.

WebSocket connection to ‘ws://localhost:xxxx/…

Please try using IP address\domain name instead of localhost. If it doesn’t help, please compare your integration with our well-tested sample: Vue | ONLYOFFICE
If the issue still persists, please reproduce the situation and collect entire Document server logs folder.

Hi,
I’m still having the issue,
here my setup.

ds.conf:

include /etc/nginx/includes/http-common.conf;
server {
listen 0.0.0.0:80;
listen [::]:80 default_server;
server_tokens off;

set $secure_link_secret mfoIJgigeLVMqxuMjGY6;

location /doc/ {
proxy_pass http://localhost:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection “upgrade”;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}

location ~ ^/[0-9.-a-z]+/doc/ {
proxy_pass http://localhost:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection “upgrade”;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}

location ~ \.map$ {
    access_log off;
    log_not_found off;
    return 204;
}

}

DockerFile:

FROM onlyoffice/documentserver:latest

ENV NODE_ENV=production
USE_SERVICE_WORKERS=true
JWT_ENABLED=true
X_FORWARDED_PROTO=http
NGINX_WORKER_PROCESSES=1
NGINX_WORKER_CONNECTIONS=1024
ALLOW_ORIGIN=*

COPY ds.conf /etc/onlyoffice/documentserver/nginx/ds.conf

EXPOSE 80

CMD [“/app/ds/run-document-server.sh”]

frontend logs:

WebSocket connection to ‘ws://127.0.0.1/9.0.4-4fb0c3cf8025be123e798f71ea733ca2/doc/_Assess%20impact%20of%20Pillar%20Two%20Model%20Rules.xlsm-1758786265/c/?shardkey=_Assess%20impact%20of%20Pillar%20Two%20Model%20Rules.xlsm-1758786265&EIO=4&transport=websocket’ failed: Error during WebSocket handshake: Unexpected response code: 400

Server logs:

apps/vendor/socketio/socket.io.min.js.map HTTP/1.1", host: “127.0.0.1”

2025/09/25 07:44:26 [error] 9615#9615: *137 open() “/var/www/onlyoffice/documentserver/web-apps/vendor/socketio/socket.io.min.js.map” failed (2: No such file or directory), client: 172.17.0.1, server: , request: “GET /9.0.4-4fb0c3cf8025be123e798f71ea733ca2/web-apps/vendor/socketio/socket.io.min.js.map HTTP/1.1”, host: “127.0.0.1”

It seems to be a proxy issue, please compare your proxy settings with our samples: Using ONLYOFFICE Docs behind the proxy
However, the entire scenario isn’t clear to me. According to you ds.conf, you’re trying to expose Document server to 80 port. This is the default port once the container is deployed, so no additional actions are needed after the container is up.
Please clarify if I misunderstood the situation.