Can`t connect ONLYOFFICE from Nextcloud proxy by Caddy in docker

Nextcloud version---------------------Docker pull nextcloud
Operating system and version-----Debian GNU/Linux 9 (stretch)
Web server------------------------------Caddy in docker
Docker version-------------------------18.06.0-ce

Hi,
I am tring to connect OnlyOffice from Nextcloud.Both OnlyOffice and Nextcloud are running in docker.

I am using portainer and running OnlyOffice with selecting interactive mode and TTY (-i -t) and using HTTPS.Now everything is running well.But I just can`t connect OnlyOffice from the nextcloud.The note said

Error when trying to connect (Bad Request or timeout error)

I am 100% sure both the containers are in one docker network.And in the OnlyOffice container the nginx is running well.

Because I am running other sites on the server,so I am running a Caddy docker as proxy.So there are 4 containers running and they are all in the same network.

Container Note
Caddy docker As proxy
Nextcloud Full version with Apache inside
Mysql Database
Onlyoffice Fulle version with everthing inside

The Caddyfile looks like this:

[nextcloud.url.me]
{
    gzip
    proxy / 172.17.0.4:80 {
        websocket
        transparent
    }
}

As the Onlyoffice container\s IP is 172.17.0.6,so I enter https://172.17.0.6 in the Onlyoffice settings,but that does not work.

The OnlyOffice container ENV details are here.

Name Value
PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
LANG en_US.UTF-8
LANGUAGE en_US:en
LC_ALL en_US.UTF-8
DEBIAN_FRONTEND noninteractive
ONLYOFFICE_HTTPS_HSTS_ENABLED true
SSL_CERTIFICATE_PATH /var/www/onlyoffice/Data/certs/onlyoffice.crt
SSL_KEY_PATH /var/www/onlyoffice/Data/certs/onlyoffice.key
SSL_DHPARAM_PATH /var/www/onlyoffice/Data/certs/dhparam.pem

The log in Nextcloud is here.

Log
Error onlyoffice HealthcheckRequest on check error: Bad Request or timeout error
Error PHP file_get_contents(https://172.17.0.6/healthcheck): failed to open stream: operation failed at /var/www/html/custom_apps/onlyoffice/lib/documentservice.php#381
Error PHP file_get_contents(): Failed to enable crypto at /var/www/html/custom_apps/onlyoffice/lib/documentservice.php#381
Error PHP file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed at /var/www/html/custom_apps/onlyoffice/lib/documentservice.php#381

I have tried to fix this issue but failed,maybe the Caddy cause this issue?I am not sure.Can somebody help me?

Have fix it by myself.

What did you do to fix it?

At first,I deploy a onlyoffice in container,but I don`t really know how this container works.

So as you can see,I use Openssl to generate onlyoffice.crt,onlyoffice.key,dhparam.pem,but it doesn`t work.

I tried several ways to fix it,but I thought that the problem is caused by Caddy or OnlyOffice,which I was TOTALLY WRONG.The nextcloud can`t connect with Onlyoffice because nextcloud will check SSL,

So I added these codes into the config.php

'onlyoffice' => 
  array ( 
       'verify_peer_off' =>TRUE, 
  ),

Now the nextcloud can connect with Onlyoffice.but when I want to edit a file,the nextcloud will try to use a Onlyoffice API,then there is another issue,as long as I enterd 172.17.0.* into nextcloud, the URL of this API is “172.17.0.*/some path I forget/api”,so the browser cannot connect the API.

So I use a domain,proxy it to onlyoffice container,entered it into nextcloud,then everything works well now.

My english is poor,sorry about that,if I have not make myself clear,tell me please.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.