解決 NextCloud + Collabora Online 的「Please ensure the file type is supported and not corrupted」錯誤

NextCloud + Collabora Online 一直是淺羽的本地 G Suite 方案,因爲開源、好用(Collabora 只能到易用的程度),並且能夠簡單地 Docker 搭建。但是最近更新 NextCloud 13 後,出現錯誤「Please ensure the file type is supported and not corrupted」,並且無法使用。

這等於是 Google Drive 沒有了 Docs/Sheets/Presenstations,這怎麼可以呢。於是第一反應是檢查 Nginx 的反代設定沒有錯誤。然而是正確的。只能翻翻資料了,結果看了一圈,發現官方論壇的一篇帖子描述了相同的問題,並且在回帖中提到:

Alright, I seem to have figured out some voodoo that works on my end.

  1. Run the Docker image as normal
  2. Keep trying to open docs on Nextcloud…
  3. Click “OK” on “Well, this is embarrassing, we cannot connect to your document. Please try again.”
  4. Click “OK” on “Service is unavailable. Please try again later and report to your administrator if the issue persists.”
  5. Keeping going back to step 3 until you finally get “Failed to load the document. Please ensure the file type is supported and not corrupted, and try again.”
  6. Click “OK” and exit to Files.
  7. Restart Docker itself (the service, not just the image).
  8. Profit.

Why this works, I have no idea but it has worked three times in a row for me. I hope it’ll help someone else and, ultimately, I hope it provides a clue needed to address the problem.

It’s not a real “Solution” but I’ll mark this as solved for now.

死馬當作活馬醫吧,靠 systemctl 重啓了 Docker 服務,結果問題(暫時)解決

內心 OS:emmm…
結論:沒有什麼是重啓不能解決的。如果有,就再重啓一次。

Nginx 反代 Collabora Online 設定檔參考如下:

server {
    listen 443 ssl;
    server_name cloud.example.com;
    # You can set a dedicated domain like:
    # server_name office.example.com;

    ssl_certificate /path/to/your/certficate;
    ssl_certificate_key /path/to/your/key;

    # Static files
        location ^~ /loleaflet {
        proxy_pass https://localhost:9980;
        proxy_set_header Host $http_host;
    }

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

    # Main websocket
    location ~ /lool/(.*)/ws$ {
        proxy_pass https://localhost:9980;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_set_header Host $http_host;
        proxy_read_timeout 36000s;
    }

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

    # Download, presentation and image upload
    location ^~ /lool {
        proxy_pass https://localhost:9980;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_set_header Host $http_host;
    }
}

發表於

發表在

標籤:

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

此網站使用 Akismet 以減少垃圾留言。 瞭解你留言資料會被如何處理.