Collabora integration, wrong source link

Dear all,

I have been trying to integrate Collabora with Seafile and, for the most part, I think, I have been successful. Yet, I still can’t open a file. Let me explain.

I serve Collabora from collabora.xyz.tld and Seafile from seafile.xyz.com. If I visit collabora.xyz.tld and collabora.xyz.tld/hosting/discovery, I get the expected responses and all references point to https://collabora.xyz.tld:443, so Collabora works.

I add the following to seahub_settings.py

OFFICE_SERVER_TYPE = "CollaboraOffice"
ENABLE_OFFICE_WEB_APP = True
OFFICE_WEB_APP_BASE_URL = "https://collabora.xyz.tld/hosting/discovery"
WOPI_ACCESS_TOKEN_EXPIRATION = 30 * 60  # seconds
OFFICE_WEB_APP_FILE_EXTENSION = (...)
ENABLE_OFFICE_WEB_APP_EDIT = True
OFFICE_WEB_APP_EDIT_FILE_EXTENSION = (...)

Yet, when I open a file on Seafile, I can see that it tries to access, for example, the following URL

https://seafile.xyz.tld:6232/browser/48bf0bf/cool.html?WOPISrc=https%3A%2F%2Fseafile.xyz.tld%2Fapi2%2Fwopi%2Ffiles%[redacted]&ui=en-US&rs=en-US&lang=en-US

I dont’ understand where Seafile/Seahub is getting the Collabora port.

I have either forgotten to set a very obvious setting or those values are hard-coded in Seafile.

Any ideas?

Thank you very much in advance.

I am not sure. I had a look at my configs, and I don’t see anything I am sure would cause that sort of problem. My best guess is that you need to update FILE_SERVER_ROOT in that same seahub_settings.py. It’s also possible that SEAFILE_SERVER_HOSTNAME= has that port number on it in your .env file.

If it is neither of those, I would suggest you find the conf directory with the config files (the directory seahub_settings.py) is in, cd into it, and run “grep 6232 *” to see if any of the config files contain the string “6232”. If grep finds that string it will give the filename, followed by the entire line containing the match.

Serendipitously I managed to fix this problem, by restarting my server. There was no problem or omission in my Docker or Seafile/Seahub configurations. Simply restarting the Seafile Docker container, or taking it down and then up again, is not enough to apply new or changed settings in seahub_setting.py. For some reason, one has to restart Docker. Or am I doing something wrong?

I am glad you got it working.

I don’t know exactly how docker handles changes to the config like that, but I wouldn’t be surprised if it takes extra steps. There were several design decisions I disliked in docker, so I switched to using podman to run the containers, so I can’t even test it on mine.

Hey there, I have this exact same issue (seafile keeps pushing its own URL:6232 instead of the collabora URL)

Is there any chance you can shed some more light on how you got it working?

Like you, I cannot figure out where port 6232 is even set, and nothing I do seems to change the URL…

Hi @Furuncle,

Sorry for the delay, I’ve see this only now. As far as I can see, this is what I have set to make Collabora work

# [seahub_settings.py]
...
OFFICE_WEB_APP_BASE_URL = "https://your.domain.name/hosting/discovery"
...
# [docker_compose.yml]

  collabora:
    image: ${COLLABORA_IMAGE:-collabora/code:24.04.5.1.1}
    container_name: collabora
    ports:
      - 6232:9980
    cap_add:
      - MKNOD
    restart: unless-stopped
    environment:
      - server_name=${COLLABORA_SERVER_HOSTNAME:?Variable is not set or empty}:${COLLABORA_PORT:-6232}
      - username=${COLLABORA_USERNAME:?Variable is not set or empty}
      - password=${COLLABORA_PASSWORD:?Variable is not set or empty}
      - dictionaries= en de it
      - DONT_GEN_SSL_CERT=true
      - TZ=${TIME_ZONE:-Europe/Berlin}
      - extra_params=--o:admin_console.enable=${COLLABORA_ENABLE_ADMIN_CONSOLE:-true}
        --o:ssl.enable=false
        --o:ssl.termination=true
        --o:user_interface.mode=classic
        --o:remote_font_config.url=${COLLABORA_REMOTE_FONT:-}
        --o:logging.file[@enable]=${COLLABORA_ENABLE_FILE_LOGGING:-false}
        --o:logging.file.property[0]=/opt/cool/logs/coolwsd.log
    volumes:
      - ${COLLABORA_PATH:-/opt/collabora}/coolwsd:/etc/coolwsd
    networks:
      - apps_net
# [.env]

# Collabora
COLLABORA_IMAGE=collabora/code:latest # image of LibreOffice
COLLABORA_SERVER_HOSTNAME=your.domain.name
COLLABORA_PORT=443
COLLABORA_USERNAME=yourusername
COLLABORA_PASSWORD=yourpassword
COLLABORA_ENABLE_ADMIN_CONSOLE=true # enable admin console or not
COLLABORA_ENABLE_FILE_LOGGING=false # use file logs or not, see FQA
COLLABORA_PATH=./data/collabora
# [nginx.conf]

server
{

  server_name your.domain.name;

  include conf.d/security_params;

 # static files
 location ^~ /browser {
   proxy_pass http://127.0.0.1:6232;
   proxy_set_header Host $host;
 }


 # WOPI discovery URL
 location ^~ /hosting/discovery {
   proxy_pass http://127.0.0.1:6232;
   proxy_set_header Host $host;
 }


 # Capabilities
 location ^~ /hosting/capabilities {
   proxy_pass http://127.0.0.1:6232;
   proxy_set_header Host $host;
 }


 # main websocket
 location ~ ^/cool/(.*)/ws$ {
   proxy_pass http://127.0.0.1:6232;

   proxy_set_header Origin '$http_origin:443'; # Temporary work around '$http_origin:$port'

   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 http://127.0.0.1:6232;
   proxy_set_header Host $host;
 }


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

}

As I mentioned in my original answer, I would probably re-compose/restart everything, including your server, after applying these settings.

Let me know.