cross-posted from: https://lemmy.ca/post/41737442

I run Caddy as my reverse proxy. I find it generally easier to configure than NGINX. I’ve never tried Traefik. I’m having a hell of a time getting Collabora office working with my NextCloud instance (both via docker) though. Has anyone else successfully done this? I’m not sure if its because I haven’t translated the config correctly from the NGINX example, or that it just doesn’t work.

I would love to see somebody’s config if they have it working.

  • BioMyth@lemmy.ml
    link
    fedilink
    English
    arrow-up
    2
    ·
    1 month ago

    Yes Yes I did, sorry! Collabora CODE server configuration in Caddy.

    office.DOMAIN {
            @collabora {
                    path /browser
                    path /browser/*
                    path /hosting/discovery
                    path /hosting/capabilities
                    path /loleaflet/*
                    path /lool/*
                    path /cool/*
            }
            @local-ip {
                    remote_ip private_ranges
            }
            reverse_proxy @collabora https://nextcloud-office:9980/ {
                    transport http {
                            tls_insecure_skip_verify
                    }
            }
            reverse_proxy @local-ip nextcloud-office:9980 {
                    transport http {
                            tls_insecure_skip_verify
                    }
            }
    }
    

    Nextcloud section, may look different from yours I use the FPM image but it should be similar, enough. There are also some limitations on the urls based on local vs public access but that is an attempt at hardening rather than necessary configurations.

    nextcloud.DOMAIN {
            root * /var/www/html
    
            file_server
    
            php_fastcgi nextcloud:9000
    
            header {
                    Strict-Transport-Security max-age=31536000;
            }
    
            @phpFiles {
                    path_regexp phpfile ^/(remote|public|cron|core/ajax/update|status|ocs/v1|ocs/v2)\.php
            }
    
            rewrite @phpFiles {http.regexp.phpfile.0}
    
            redir /.well-known/carddav /remote.php/dav 301
            redir /.well-known/caldav /remote.php/dav 301
    
            @local-ip {
                    not remote_ip private_ranges
                    path /settings/admin
                    path /settings/admin/*
                    path /settings/users
                    path /settings/users/*
                    path /settings/apps
                    path /settings/apps/*
            }
            #respond @local-ip 404
    
            @forbidden {
                    path /.htaccess
                    path /data/*
                    path /config/*
                    path /db_structure
                    path /.xml
                    path /README
                    path /3rdparty/*
                    path /lib/*
                    path /templates/*
                    path /occ
                    path /console.php
            }
            respond @forbidden 404
    }
    

    Then in nextcloud you just point it to the CODE server domain above & you even have tls securing the communication layer.

    • SteveDinn@lemmy.caOP
      link
      fedilink
      arrow-up
      2
      ·
      1 month ago

      Thankyou! Nextcloud itself wàs never a problem, but the Collabora stuff would just not work properly with any config I tried. I’m going to make another attempt with these settings as soon as I get the chance.

    • SteveDinn@lemmy.caOP
      link
      fedilink
      arrow-up
      1
      ·
      1 month ago

      Hrm…I must have had something else wrong because I’m experiencing the same thing. I try to load a document that I created with the menu and it seems to time out. I thought that it was because of my Caddy config, but perhaps it wasn’t.

      I only get: Document loading failed Failed to load Nextcloud Office - please try again later

      • BioMyth@lemmy.ml
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 month ago

        What does your compose file for CODE look like? It took me a while to get those environment variables set so it would work correctly.

        • SteveDinn@lemmy.caOP
          link
          fedilink
          arrow-up
          1
          ·
          1 month ago

          The docker config is nothing special:

          collabora:
              hostname: collabora
              image: collabora/code
              restart: "no"
              privileged: true
              cap_add:
                - MKNOD
              networks:
                - default
              env_file: collabora.env
              ports:
                - 8054:9980
          

          Env: Besides username, password, and this line:

          extra_params=--o:ssl.enable=true
          

          I have 2 other variables set: domain and aliasgroup1. Is domain supposed to refer to the Collabora domain or the NextCloud domain? I actually can’t remember where I got the aliasgroup1 from, but it was probably during my googling to try and get things working. I remember reading that the ‘.’ characters had to be escaped because those lines were used in a reflex.