Onlyoffice container on domain

I have a problem with integrating document server to my domain, I have a balancer that forwards https to my machine, which is called sud.domain.com, onlyoffice document server is deployed on this machine via docker, I am trying to proxy requests to onlyoffice via a container.
After loading index_loader, nothing happens in the network tab
I use documentserver in conjunction with react
Below I will attach the nginx, docker compose configuration. Please tell me how I should act.
The first screenshot shows how I access documentserver via react
The 2nd screenshot shows the nginx configuration for proxying requests to the OO container
The 3rd screenshot shows the docker compose file

please help, I will be very grateful

Снимок экрана от 2025-03-22 13-09-11


Снимок экрана от 2025-03-22 13-12-12

Hello there,
is your nginx-proxy on the same network-stack as your onlyoffice-container?
Can you access onlyoffice directly via http(s)://yourhost/onlyoffice/ ?

Hello, thanks for the answer.

  1. Yes, 2 containers with nginx and OO are in 1 network.
  2. Yes, when I enter https/my.domain.com/onlyoffice/ in the search bar, a redirect occurs to
    https://my.domain.com/welcome/
    , where I see a message that ONLYOFFICE Docs Community Edition is installed
    below I will attach the necessary screenshots about the redirect and after which files exactly the launch of OO docservice stops (after index_loader)
    ![Снимок экрана от 2025-03-23 22-13-01|690x350(upload://pPKe2uXwXI3q5BSZndtfEMaC6WP.png)
    Снимок экрана от 2025-03-23 22-15-26

sorry, i cant attach 2 screens , I will attach it below

Hello again.
It seems your setup is running. That is good. Let’s focus on our proxy then. I personally don’t know much about “react”. Proxying can be a little tricky thou. One character or one missing rule can make a huge difference. So I like to test things step by step.

Try to change your rewrite rule to this:

   rewrite /onlyoffice/(.*) /$1 break;

And also try to run it with and without http_proxy_version set to 1.1:

   proxy_http_version 1.1;

I also recommend to use those 2 rules, when redirecting from/to subfolders:

   proxy_set_header Upgrade $http_upgrade;
   proxy_set_header Connection "upgrade";

Restart the container or (better) just reload the nginx inside the container when testing new configuration:

docker exec -it <container-name/container-ID> nginx -s reload

And just to be sure, reload the page in your browser with CTRL+F5 to force the browser cache for that particular address to be flushed instead of being reused.

Hello, thanks for ur answer , I tried your recommendations, but nothing worked, and sorry for the misinformation, but apparently if I enter https/my.domain.com/onlyoffice/ in the address bar, a redirect to /welcome occurs and I see nothing on the screen, no errors, nothing
The screenshot below shows what I see


my nginx.conf in Nginx container to proxy /onlyoffice/
location /onlyoffice/ {
rewrite /onlyoffice/(.*) /$1 break;
proxy_pass http://onlyoffice/;

        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 https;
      

       
    }

proxy frontend
location / {
proxy_pass http://frontend:3000/;

    }   

and I don’t know if this will help you
my nginx.conf in frontend container
types {
application/javascript js;
application/javascript mjs;
}

server {
listen 3000;
server_name localhost;

root /usr/share/nginx/html/;
index index.html;

location / {
try_files $uri /index.html;
}
include /etc/nginx/extra-conf.d/*.conf;

}

What does the Debugging-Console in your browser show when you open “https://my.domain.com/onlyoffice/”?

I use Firefox. Debugging-Console can be accessed via F12 followed by activating Network.
Look for errors and warnings.

thank you for the answer, there is nothing erors , no warns, no errors , even if I enter https/my.domain.com/non-existent address, it will be the same, most likely this is because I did not set up a 404 page.
and most likely https/my.domain.com/onlyoffice does not exist, but the redirect still occurs to /welcome/

and I also just saw that after loading api.js, OO
loads index_loader, but it turns out with the contents of my index.html

React App You need to enable JavaScript to run this app.
but should be this ONLYOFFICE Document Editor .content-theme-dark { --skeleton-canvas-content-background: #3a3a3a; --skeleton-canvas-page-border: #616161; --skeleton-canvas-line: rgba(255,255,255,.05); }
        .loadmask {
            left: 0;
            top: 0;
            position: absolute;
            height: 100%;
            width: 100%;
            overflow: hidden;
            border: none;
            background: #e2e2e2;
            background: var(--canvas-background, #e2e2e2);
            z-index: 1002;
        }

        .loadmask > .brendpanel {
            width: 100%;
            min-height: 28px;
            background: #446995;
            background: var(--toolbar-header-document, #446995);
        }

        .pdf-form .loadmask > .brendpanel {
            background: #AA5252;
            background: var(--toolbar-header-pdf, #AA5252);
        }

        .loadmask > .brendpanel > div {
            display: flex;
            align-items: center;
            height: 28px;
        }

        .loadmask > .brendpanel .spacer {
            margin-left: auto;
        }

        .loadmask > .brendpanel .loading-logo {
            padding: 0 24px 0 12px;
            max-width: 200px;
            height: 20px;
        }

        .loadmask > .brendpanel .loading-logo > img {
            display: inline-block;
            max-width: 100px;
            max-height: 20px;
            opacity: 0;
        }

        .loadmask > .brendpanel .rect {
            vertical-align: middle;
            width: 50px;
            height: 12px;
            border-radius: 3px;
            margin: 0 10px;
            background: rgba(255,255,255,.2);
            background: var(--highlight-header-button-hover, rgba(255,255,255,.2));
        }

        .loadmask > .brendpanel .circle {
            vertical-align: middle;
            width: 20px;
            height: 20px;
            border-radius: 20px;
            margin: 0 10px;
            background: rgba(255,255,255,.2);
            background: var(--highlight-header-button-hover, rgba(255,255,255,.2));
        }

        .loadmask > .sktoolbar {
            background: #f1f1f1;
            background: var(--background-toolbar, #f1f1f1);
            border-bottom: 1px solid #cbcbcb;
            border-bottom: var(--scaled-one-px-value, 1px) solid var(--border-toolbar, #cbcbcb);
            height: 46px;
            padding: 10px 6px;
            box-sizing: content-box;
        }

        .loadmask > .sktoolbar ul {
            margin: 0;
            padding: 0;
            white-space: nowrap;
            position: relative;
            height: 25px;
        }

        .loadmask > .sktoolbar li {
            background: #d8dadc;
            background: var(--highlight-button-hover, #d8dadc);
            border-radius: 3px;
            width: 20px;
            height: 20px;
            display: inline-block;
            margin-right: 6px;
        }

        .loadmask > .sktoolbar li.space {
            background: none;
            width: 0;
        }

        .loadmask > .sktoolbar li.big {
            width: 40px;
            height: 46px;
            margin-top: -46px;
        }

        .loadmask > .sktoolbar li.fat {
            position: absolute;
            right: 0;
            top: 0;
            bottom: 0;
            left: 522px;
            width: inherit;
            height: 44px;
        }

…etc

I think there is some kind of problem with the proxy

But you did somehow reach your OO-installation before? You made a screenshot of the welcome page. If it’s getting redirected, that is a good sign already. But why it has no content now? We need to know that OO is up and running. Then it’s probably a proxy problem. As I mentioned before, I don’t deal with react, that I can’t help you with. Usually you can catch misconfiguration with Debugging-Console as you can see where you browser is being redirected or what sources/addresses it gets back from the host.
You are not inside a cloud-hoster by any chance … like cloudfront?

EDIT:
When you access “https://my.domain.com/onlyoffice/” you always get redirected to “https://my.domain.com/onlyoffice/welcome”. To test if onlyoffice is running and accessible without your proxy you can try to access OO welcome page directly via “https://host/onlyoffice/welcome” from inside your network behind your proxy. If necessary adjust to the correct port you expose it on, for example “https://host:port/onlyoffice/welcome”. Once we know things are ok with OO, we can figure out the necessary proxy configuration to access it.
Most people usually follow some tutorial or other instructions. Which instructions are you following?

Hello there, thanks for the answer , I decided to do it differently
and proxy to onlyoffice:8000, and my files started to download, but another problem with websocket arose, can you tell me what the problem is?

[2025-03-25T08:10:28.568] [WARN] [localhost] [docId] [userId] nodeJS - io.connection_error code=3, message=Bad request
[2025-03-25T08:10:29.021] [WARN] [localhost] [docId] [userId] nodeJS - io.connection_error code=3, message=Bad request
[2025-03-25T08:10:47.511] [WARN] [localhost] [docId] [userId] nodeJS - io.connection_error code=3, message=Bad request
[2025-03-25T08:10:47.916] [WARN] [localhost] [docId] [userId] nodeJS - io.connection_error code=3, message=Bad request
[2025-03-25T08:11:29.187] [WARN] [localhost] [docId] [userId] nodeJS - io.connection_error code=3, message=Bad request
[2025-03-25T08:11:30.052] [WARN] [localhost] [docId] [userId] nodeJS - io.connection_error code=3, message=Bad request
[2025-03-25T08:12:24.625] [WARN] [localhost] [docId] [userId] nodeJS - io.connection_error code=3, message=Bad request
[2025-03-25T08:12:25.391] [WARN] [localhost] [docId] [userId] nodeJS - io.connection_error code=3, message=Bad request
[2025-03-25T08:14:48.319] [WARN] [localhost] [docId] [userId] nodeJS - io.connection_error code=3, message=Bad request
[2025-03-25T08:14:49.069] [WARN] [localhost] [docId] [userId] nodeJS - io.connection_error code=3, message=Bad request

there are logs in OO container

and error in console

socket.io.min.js:6 WebSocket connection to ‘wss://my.domain.com/onlyoffice/doc/af508af9-c85e-47dd-8d41-704f91817536/c/?shardkey=af508af9-c85e-47dd-8d41-704f91817536&EIO=4&transport=websocket’ failed:

Hello again,
I’m not familiar with websocket errors. But from what I have seen, this should look like:

wss://my.domain.com/A.B.C-D/doc/...

where A to D correspond to the version of OO used. So it seems to me, this is again proxy connected.
I checked my own logs and my browsers debugging-console, and I don’t see anything related to websockets. But in my setup I run Nextcound and Openoffice on the same host in different docker-containers and I connect them via “ds-vpath” I have set up in my proxy configuration. This way my OO-container is not exposed to the outside world at all.

By any chance, if you are still going via your proxy, I just spotted something. It is easy to oversee, but you must also configure X-Forwarded-Host:

   location /onlyoffice/ {
   #<some other important stuff>
      proxy_set_header X-Forwarded-Host $http_host/onlyoffice;
   #<more other important stuff>
}

This is due to how nginx inside OO maps the variables.

Hello @IvanDeveloper

In terms of hosting Document Server behind a proxy I’d recommend checking out samples of proxy configuration that we provide here:

This article contains examples for different usage scenarios and for several most popular services. Take a look at the recommended configuration that corresponds to your environment and check out if your configuration is missing anything. It might help in resolving the proxy issue.

hello there,
Thank you very much, it was thanks to this header that everything worked))
God bless u)

1 Like

thank u for the answer