Nextcloud/collabora/nginx not working

Hopefully I can explain my setup.

I am using cloudflare as a DNS server for my domain
I have the following records

nextcloud.example.com for my nextcloud host
collabora.example.com for my collabora CODE host
both point to my server at home.
This server is running Ubuntu with docker.
Inside docker I have nginx as a reverse proxy to redirect the incomming request.
all the scripts are shown below.

I can browse to nextcloud address, and nextcloud seems to be working properly.
I have installed nextcloud office and configured it to contact through collabora address.
The admin page of nextcloud office is showing the message “Collabora Online server is reachable”. I can create new office files inside the files app. The new file is being created.
But when I want to open the file I get an error “Document loading failed
Failed to load Nextcloud Office - please try again later”

docker-compose1

version: '3.8'

networks:
  my_network:
    external: true
    name: my_bridge_network

services:
  ng_nextcloud:
    container_name: ng_nextcloud
    networks:
      - my_network
    image: nextcloud
    ports:
      - 8080:80
    volumes:
      - ./appdata:/config
      - ./data:/data
    environment:
      - PUID=1000
      - PGID=1000
      - OVERWRITEHOST=nextcloud.example.eu
      - TZ=Europe/Amsterdam

  collabora:
    container_name: collabora_code
    networks:
      - my_network
    image: collabora/code
    ports:
      - "9980:9980"
    environment:
      - server_name=nextcloud.example.eu
    volumes:
      - ./coolwsd/coolwsd.xml:/etc/coolwsd/coolwsd.xml

docker-compose2

version: '3.8'

services:
  mariadb:
    image: mariadb
    networks:
      - my_network
    container_name: mariadb
    environment:
      MYSQL_ROOT_PASSWORD: ${mariadb_root_password}
      MYSQL_DATABASE: ${mariadb_db_name}
      MYSQL_USER: ${mariadb_user}
      MYSQL_PASSWORD: ${mariadb_password}
    volumes:
      - mariadb_data:/var/lib/mysql
    ports:
      - "3306:3306"
    restart: unless-stopped

  nginx:
    container_name: nginx
    networks:
      - my_network
    image: nginx
    volumes:
      - ./proxy/nginx.conf:/etc/nginx/conf.d/default.conf
      - ./proxy/.htpasswd:/zigbee2mqtt_htpasswd
      - ./ssl:/etc/nginx/certs:ro"
    ports:
      - "443:443"
    restart: unless-stopped

networks:
  my_network:
    driver: bridge
    name: my_bridge_network

volumes:
  mariadb_data:

nginx config

server {
  listen              443 ssl;
  ssl_certificate     /etc/nginx/certs/www.example.eu.crt;
  ssl_certificate_key /etc/nginx/certs/www.example.eu.key;
  ssl_protocols       TLSv1 TLSv1.1 TLSv1.2;
  server_name nextcloud.example.eu;

  location / {
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade"; #syntax change here
    proxy_pass http://ng_nextcloud:80;
  }
}

#new collabora stuff
server {
 listen       443 ssl;
 server_name  collabora.example.eu;


 ssl_certificate     /etc/nginx/certs/www.example.eu.crt;
 ssl_certificate_key /etc/nginx/certs/www.example.eu.key;

 # static files
 location ^~ /browser {
   proxy_pass https://collabora_code:9980;
   proxy_set_header Host $host;
 }


 # WOPI discovery URL
 location ^~ /hosting/discovery {
   proxy_pass https://collabora_code:9980;
   proxy_set_header Host $host;
 }


 # Capabilities
 location ^~ /hosting/capabilities {
   proxy_pass https://collabora_code:9980;
   proxy_set_header Host $host;
 }


 # main websocket
 location ~ ^/cool/(.*)/ws$ {
   proxy_pass https://collabora_code:9980;
   proxy_set_header Upgrade $http_upgrade;
   proxy_set_header Connection "Upgrade";
   proxy_set_header Host $host;
   proxy_read_timeout 36000s;
 }


 # download, presentation and image upload
 location ~ ^/(c|l)ool {
   proxy_pass https://collabora_code:9980;
   proxy_set_header Host $host;
 }

# Admin Console websocket
 location ^~ /cool/adminws {
   proxy_pass https://collabora_code:9980;
   proxy_set_header Upgrade $http_upgrade;
   proxy_set_header Connection "Upgrade";
   proxy_set_header Host $host;
   proxy_read_timeout 36000s;
 }
}

i tried some debugging in chrome and got to this point where i think i get an error from cloudflare. I am not very experienced in all this and don’t know what this means. this is the consolde output when i try to open a document from within the nextcloud “file” app.

Also I noticed that the websockets do not work with the nginx config from the collabora webpage.

Yesterday I changed from the latest docker image of collabora/code to 24.04.12.4.1 and all of the sudden it works.
Can someone explain way this would be the case? I am very happy though.

One thing I do notice is, when I create a new file, it’s is immediately created and opened. This always results in an error.
If I wait a little and open the file from nextcloud ‘file’ app it opens correctly like the server needs some time to prepare the file…

I tried different docker images but everyone >= 24.04.13.1.1 seems to fail