Document loading failed - nextcloud aio

I could send them to you but with all others reverse proxies is also here the idea to enable websockets for the whole domain so that the webserver inside AIO can handle all needed details. Otherwise it will not scale because we always need to adjust the apache config, too if we want change something internallyā€¦

When i try to load a document on the server all execept this line return http 200.

"GET /onlyoffice/web-apps/apps/api/documents/api.js HTTP/2.0" 304

This is from the apache reverse proxy access.log

Iā€™ve tried a bunch of different ways to get websocket to work, but none of them worked.

Hereā€™s some examples of what iā€™ve tried:

1:
    RewriteCond %{HTTP:Upgrade} websocket [NC]
    RewriteCond %{HTTP:Connection} upgrade [NC]
    RewriteRule .* "ws://localhost:11000/$1" [P,L]

2:
  RewriteCond %{HTTP:Upgrade} =websocket [NC]
  RewriteRule /(.*)           ws://localhost:11000/$1 [P,L]
  RewriteCond %{HTTP:Upgrade} !=websocket [NC]
  RewriteRule /(.*)           http://localhost:11000/$1 [P,L]

3:
    RewriteRule ^/(.*) "ws://locahost:11000/$1" [P,L]
    RewriteRule /(.*) "ws://locahost:11000/$1" [P,L]
    ProxyPassMatch (.*)(\/websocket)$ "ws://127.0.0.1:11000/$1$2"

4:
   SetEnvIf Host "^(.*)$" THE_HOST=$1
   RequestHeader setifempty X-Forwarded-Proto https
   RequestHeader setifempty X-Forwarded-Host %{THE_HOST}e
   ProxyAddHeaders Off
   ProxyPassMatch (.*)(\/websocket)$ "ws://127.0.0.1:11000/$1$2"

5:
    RewriteCond %{HTTP:Upgrade} websocket               [NC]
    RewriteRule /(.*)           ws://localhost:11000/$1  [P,L]

Hope some of them could give you an idea on how to fix this.

After i updated to the new release that has just dropped the error has disappered and it is now working !

Here is the apache config i ended with if you want it for the docs:

<VirtualHost *:80>
     ServerName cloud.domain.com
     ServerAlias cloud.domain.com
     LogFormat "%v - %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" comonvhost
     CustomLog /var/log/httpd/access_log comonvhost

     RewriteEngine On
     RewriteCond %{HTTPS} off
     RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

    RewriteCond %{SERVER_NAME} =cloud.domain.com
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerName cloud.domain.com
    ServerAlias cloud.domain.com
    LogFormat "%v - %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" comonvhost
    CustomLog /var/log/httpd/access_log comonvhost

    # Reverse proxy
    RewriteEngine On
    ProxyPreserveHost On

    RewriteCond %{HTTP:Upgrade} websocket [NC]
    RewriteCond %{HTTP:Connection} upgrade [NC]
    RewriteRule .* "ws://localhost:11000/$1" [P,L]
    ProxyRequests off

    ProxyPass / http://localhost:11000/
    ProxyPassReverse / http://localhost:11000/

    # Enable h2, h2c and http1.1 for https
    Protocols h2 h2c http/1.1

    # SSL (Not nessarry if not runinng backend in ssl)
    SSLProxyEngine On
    SSLProxyVerify none
    SSLProxyCheckPeerCN off
    SSLProxyCheckPeerName off
    SSLProxyCheckPeerExpire off

    Header set X-Frame-Options "SAMEORIGIN"
    Header always set Strict-Transport-Security "max-age=15768000; includeSubDomains; preload"
    <Files ".ht*">
        Require all denied
    </Files>

    # Disable HTTP TRACE method.
    TraceEnable off

Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/cloud.domain.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/cloud.domain.com/privkey.pem
</VirtualHost>
</IfModule>

Very cool, great! :slight_smile:

Hey, i just tried my first nextcloud installation, i always thought it would be easy with a stable release and docker. But it is absolutely not possible for me to run collabora.

Is there a reason, why it was not possible for me to find a config for an external apache (as reverse proxy outside a docker container).

This page only lists ngnix. Is the apache as reverse proxy actually not supported?

The config here from @jpix is the first complete. So many thanks for that. But it seems also not to work for me.

I still get the following errors in chrome

WebSocket connection to ā€˜wss://cloud.mydomain.com/push/wsā€™ failed:

WebSocket connection to ā€˜wss://cloud.mydomain.com/cool/httpā€¦ā€™ failed:

For now there are no applications on that system using websockets.
Do i have to enable websockets on any point in the system (debian linux)?
(The apache modules as listed above are running.)

I also tried it on firefox nightly and edge to avoid uBlock issues.

I already spent too much time on that. Is there a way to get an running instance? Is it possible to install a nextcloud AIO docker image version that works together with an apache reverse proxy?

We are currently working on documenting apache as well. See add apache to reverse proxy documentation by szaimen Ā· Pull Request #679 Ā· nextcloud/all-in-one Ā· GitHub

I can see you are typing wss. Are you using secure socket?
You could try with ws:// instead.

The apache config i provided is for running nextcloud aio in docker and apache on the host.

I made two notes for that request on github :slight_smile:

1 Like

Thanks! :slight_smile:

Yes, i use the same config as yours, except of another domain name, log style and my own cert paths.
The nextcloud is reachable under https, without any certificate problems.

The two messages mentioning the wss are from the browser when opening a collabora document.

Yes and the config you provided is the one on the host, or am I wrong?

BTW you have a typo in there, there is missing a l in locaLhost, itā€™s the same as in the github change add apache to reverse proxy documentation by szaimen Ā· Pull Request #679 Ā· nextcloud/all-in-one Ā· GitHub

@szaimen Thank you for the reply, is there a reason why the apache part is not published for now? Maybe with a reference to this thread, as it is done in the Nginx part referencing the issues there?

To me it seems more that the container is not able to handle the websockets. @jpix are you on the beta channel of the AIO docker or the latest?

Im on the lastest version.
After i posted this issue i updated nextcloud docker containers and it fixed it self.
I did this to update:

docker pull nextcloud/all-in-one
docker pull nextcloud/aio-domaincheck
docker pull nextcloud/aio-apache
docker pull nextcloud/aio-nextcloud
docker pull nextcloud/aio-clamav
docker pull nextcloud/aio-redis
docker pull nextcloud/aio-collabora
docker pull nextcloud/aio-onlyoffice
docker pull nextcloud/aio-postgresql
docker pull nextcloud/aio-talk

I have changed the apache configuration to fix the typo.

And that config is on the apache host. Not from the docker image.

Do you have any logs from inside the docker container when you try to load a document.
I ended up with running onlyoffice since i didnt want to change after i got that one working. Might try collabora another time.
And did you also do a manual install or ?

I used the command from the readme.

sudo docker run -it -d \
--name nextcloud-aio-mastercontainer \
--restart always \
-p 9080:8080 \
-e APACHE_PORT=11000 \
--volume nextcloud_aio_mastercontainer:/mnt/docker-aio-config \
--volume /var/run/docker.sock:/var/run/docker.sock:ro \
nextcloud/all-in-one:latest

I only tried it with collabora not onlyoffice. Maybe i will try that if i got time.

I eliminated the websocket-problems from browser (404) by using this rewrite rule.

RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule ^/(.*)$ ws://localhost:11000/$1 [P,L]

Yes it is on the host. Not the apache docker.
I am on the latest version of the docker containers.

I am not sure where i can find the correct log file. In which container do i have to search?

Iā€™am not sure if i understood that correct. The traffic goes from my reverse proxy (apache) to the apache-docker (port 11000) from there, dependent on which path it is, it will be forwarded to the next-cloud, the aio-master or the collabora container? Is this correct?
So if we forward all the traffic to the apache-docker and it doesnā€™t reach the collabora container (or wrong), isnā€™t the error on the apache container?

I keep having problems with Collabora on Nextcloud AIO. It worked when I installed Nextcloud without Docker (more or less, it often failedā€¦), but now it simply fails.
Iā€™m sorry if Iā€™m not contributing to the discussione: is there something I can do to go deeper in the problem?

I installed the OnlyOffice container and it works perfectly.

Hi, are you trying to run collabora behind apache?

Unfortunately we have not managed to find a solution to this problem, yet. We are tracking the problem in Make collabora work behind Apache Ā· Issue #834 Ā· nextcloud/all-in-one Ā· GitHub

1 Like

I am, in the sense that I installed the docker image of Nextcloud AIO and it should make Collabora work by itselfā€¦ I thought that given that they are packed together it should work.
I succeded previously in making it work installing Nextcloud and Collabora without Docker, although it was very unstable. Now Iā€™m talking about the docker image that comes installed with Nextcloud AIO.

I actually am using an apache reverse proxy to be able to host multiple websites on my VPS.

Thank you very much, Iā€™ll keep watching on Github.

Yes that is correct but it seems like collabora is not working when using Apache as reverse proxy in front of AIO. Most likely it is a missing detail in the apache reverse proxy documentation. It works behind all other documented reverse proxies and on a ā€œnativeā€ aio instance as well. You have now the option to use onlyoffice until this is resolved or better help us finding out what we need to change in the Apache Reverse proxy documentation in order to make it work.