问题描述
我正在使用 Docker Swarm 通过 Collabora 实施 Owncloud,但我遇到了几个问题。
当我为 Collabora 打开文档时,我收到以下日志:
[docbroker_003] WRN Poco::Net::DNS:: resolveOne ("IP") Failed: Host not found: IP | wsd/Storage.cpp: 186
[docbroker_003] ERR loading document exception: Host not found | wsd/Documentbroker.cpp: 1429
[docbroker_003] ERR Failed to add session to [/apps/richdocuments/wopi/files/14_ock7koz4yimw_0_0] with URI [http://IP:8080/apps/richdocuments/wopi/files/ 14_ock7koz4yimw_0_0 access_token = ALd4bQKRdCqBphrG73XEKZ7CgCiIbbW4 & access_token_ttl = 0]: Host not found | wsd/Documentbroker.cpp: 1391
然而,主机存在,在容器内我可以成功地卷曲这个 URL。
当我通过 DNS(不是 IP)访问 Owncloud 时,出现此错误
[docbroker_005] ERR No acceptable WOPI hosts found matching the target host [HOST] in config. | wsd/Storage.cpp: 292
[docbroker_005] ERR loading document exception: No acceptable WOPI hosts found matching the target host [HOST] in config. | wsd/Documentbroker.cpp: 1429
[docbroker_005] ERR Failed to add session to [/apps/richdocuments/wopi/files/14_ock7koz4yimw_0_0] with URI [HOST:8080/apps/ richdocuments/wopi/files/14_ock7koz4yimw_0_0? access_token = X9wFvx_W_4_mhttp the target host [HOST] in config. | wsd/Documentbroker.cpp: 1391
仅当我将容器网络作为主机时才有效。
在另一个环境中,仅使用 Docker Compose(不使用 Swarm)可以完美运行。
有什么想法吗?
来自 Owncloud 和 Collabora 的图像是该中心的最新图像。 Docker 版本为 18.09。
谢谢。
解决方法
解决方案:
在标签内的 loolwsd.xml 文件中添加包含 IP 正则表达式的行。
<wopi desc="Allow/deny wopi storage. Mutually exclusive with webdav." allow="true">
<host desc="Regex pattern of hostname to allow or deny." allow="true">localhost</host>
<host desc="Regex pattern of hostname to allow or deny." allow="true">10\.[0-9]{1,3}\.[0-9]{1,3}</host>
<host desc="Regex pattern of hostname to allow or deny." allow="true">172\.1[6789]\.[0-9]{1,3}</host>
<host desc="Regex pattern of hostname to allow or deny." allow="true">172\.2[0-9]\.[0-9]{1,3}</host>
<host desc="Regex pattern of hostname to allow or deny." allow="true">172\.3[01]\.[0-9]{1,3}</host>
<host desc="Regex pattern of hostname to allow or deny." allow="true">172\.9[01]\.[0-9]{1,3}</host>
<host desc="Regex pattern of hostname to allow or deny." allow="true">192\.168\.[0-9]{1,3}</host>
<!--
host desc="Regex pattern of hostname to allow or deny." allow="true">[0-9]{1,3}</host
-->
<host desc="Regex pattern of hostname to allow or deny." allow="false">192\.168\.1\.1</host>
<max_file_size desc="Maximum document size in bytes to load. 0 for unlimited." type="uint">0</max_file_size>
<reuse_cookies desc="When enabled,cookies from the browser will be captured and set on WOPI requests." type="bool" default="false">false</reuse_cookies>
<locking desc="Locking settings">
<refresh desc="How frequently we should re-acquire a lock with the storage server,in seconds (default 15 mins) or 0 for no refresh" type="int" default="900">900</refresh>
</locking>
</wopi>