Collabora Online - Unable to connect to CODE behind NGINX reverse proxy

Hello,
I’ve been trying to setup collabora on my nextcloud instance, but I haven’t been able to get it working.

My problem is that when proxying nextcloud through nginx, adding the collabora online server via it’s ip reports it to be working, but when trying to open a file, it fails. I haven’t been able to find instructions that work on how to proxy the collabora online through nginx.

Currently, my nextcloud is running in a docker container and configured to respond on the /nextcloud subpath, but i have also tried using it’s own domain on a virtual machine; it also didn’t work.

I have it proxied as follows:

location /nextcloud {
    proxy_pass http://localhost:8080/;
    client_max_body_size 128M;
}

location /nextcloud/ {
    rewrite ^/nextcloud(.*) $1 break;
    proxy_pass http://localhost:8080/;
    client_max_body_size 128M;
}

Thanks in advanced