Try the fastest and simplest way to install ONLYOFFICE

DocumentServer v5 (Docker with Nginx) behind external Nginx

Questions/problems on Docker

DocumentServer v5 (Docker with Nginx) behind external Nginx

Postby AndrewG » Tue Nov 28, 2017 5:43 am

Hi all,

guys, need support / advice how to set up Document Server v5 (Docker version) with its embedded Nginx behind external Nginx?

DocumentServer (Docker) uses self-signed cert, HTTPS available on the port 18443
External Nginx provides valid SSL-cert and listens on the port 18445

I need the following schema to work properly:

Client -----> External Nginx (18445) -----> DocumentServer (Docker + Nginx) 18443

On the external Nginx I have the following config:

Code: Select all
upstream onlyoffice_node {
    server weight=100 max_fails=5 fail_timeout=5;

server {

    listen                       18445 ssl;

    ssl_certificate              /etc/nginx/ssl/cert1.crt;
    ssl_certificate_key          /etc/nginx/ssl/cert1.key;

    ssl_protocols               TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers                 HIGH:!aNULL:!MD5;

    client_max_body_size         100M;

    location / {
        proxy_connect_timeout  600;
        proxy_send_timeout     600;
        proxy_read_timeout     600;
        send_timeout           600;

        proxy_pass             https://onlyoffice_node;
        proxy_redirect         https://$host/      https://$host:$server_port/; #fixes reedirect sent from the proxied server

        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-Forwarded-For     $remote_addr;
        proxy_set_header       X-Forwarded-For     $proxy_add_x_forwarded_for;
        proxy_set_header       X-Remote-IP         $remote_addr;

        proxy_set_header       X-Forwarded-Host    $host;
        proxy_set_header       X-Forwarded-Server  $host;       
        proxy_set_header       X-Forwarded-Proto   $scheme;


After I have added this line:
Code: Select all
proxy_redirect         https://$host/      https://$host:$server_port/;

Document Editor is being loaded properly, but I am getting issue with "lost port" when Document Editor tries to pull file for editing:

Error in Browser console:
Code: Select all
Failed to load Redirect from '' to ';appJSID=11826ff661e6858c998cfc3fe775' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '' is therefore not allowed access.

In the error listing above address "Failed to load ... 0519823.... actually should be "... ... 0519823.... but port ":18445" got lost (so in case I manually ad the port 18445 - link became accessible).

Also CORS is properly adjusted and without external Nginx everything works fine.

Appreciate any advice how to adjust external Nginx config! Thank you!
Best regards,
User avatar
Posts: 18
Joined: Sat May 06, 2017 3:09 am

Re: DocumentServer v5 (Docker with Nginx) behind external Ng

Postby Maxim » Tue Nov 28, 2017 6:42 am

Hello AndrewG!
Maybe this will help you. There are some examples of document-server-proxy config.
Posts: 1300
Joined: Tue Oct 11, 2016 2:34 pm

Re: DocumentServer v5 (Docker with Nginx) behind external Ng

Postby AndrewG » Tue Nov 28, 2017 10:13 am

Hi Maxim,

Thank you for your reply! Yes, I have seen that info and also this one: ... proxy.aspx
It is super useful manuals / config samples, but looks like they are used for the case when DocumentServer deployed manually, separately from the Nginx, as these configs are the same to the ones used inside the DocumentServer (Docker) version.

In this particular case we need to deploy DocumentServer (on Docker) inside existing environment with externally managed Nginx server, with minimal configuration efforts as on external Nginx, as well as on the Docker image.

Thank you for any additional guidance!
Best regards,
User avatar
Posts: 18
Joined: Sat May 06, 2017 3:09 am

Return to Docker Version

Who is online

Users browsing this forum: No registered users and 4 guests