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 127.0.0.1:18443 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 https://30x-dev1.app.ua/cache/files/ds1-db0-c03d-5a05198233ecdf1c04cc8636/Editor.bin/Editor.bin?md5=tLsTHuhLaAZaDlN0i6vj6g==&expires=1514438849&disposition=attachment&ooname=output.bin: Redirect from 'https://30x-dev1.app.ua/cache/files/ds1-db0-c03d-5a05198233ecdf1c04cc8636/Editor.bin/Editor.bin?md5=tLsTHuhLaAZaDlN0i6vj6g==&expires=1514438849&disposition=attachment&ooname=output.bin' to 'https://30x-dev1.app.ua/login.xhtml;appJSID=11826ff661e6858c998cfc3fe775' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://30x-dev1.app.ua:18445' is therefore not allowed access.


In the error listing above address "Failed to load https://30x-dev1.app.ua/cache/files/ds1 ... 0519823.... actually should be "...https://30x-dev1.app.ua:18445/cache/fil ... 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,
Andrew
User avatar
AndrewG
 
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.
Maxim
 
Posts: 1237
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: https://helpcenter.onlyoffice.com/serve ... 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,
Andrew
User avatar
AndrewG
 
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 3 guests

cron