Lucent's Blog

当时明月在,曾照彩云归。



代码在写我

Bug在De我

螃蟹在剥我的壳

漫天的我落在雪花上

而你在想我...

6LCi5Y2O5qKFLOaIkeaDs+S9oOS6hg==

记录使用NextCloud连接OnlyOffice时遇到的问题

问题

在NextCloud后台设置连接OnlyOffice时一切正常,并且域名为https,
NextCloud域名和OnlyOffice域名均使用nginx代理(使用了宝塔,方便管理),OnlyOffice只对外映射了80端口,证书使用了nginx配置,但是在打开文档时会报错:

Refused to frame 'http://office.xxx.com' because itviolates the following Content Security Policy directive: "frame-src 'self' https://demo.ja.collaboraonline.com https://office.xxx.com/"

sada

原因

OnlyOffice内部不够智能,不能自动升级https请求

解决方案

以下方案对我有效:

1.修改NextCloud配置

修改NextCloud根目录/config下的config.php文件
在最下面加上

'allow_local_remote_servers' => true

image.png

2.修改OnlyOffice的Nginx的反向代理配置

直接把反向代理的配置替换成如下代码(自行修改ip和端口):

location /
{
    proxy_pass http://10.0.12.5:30010;
		proxy_set_header Host $host:443;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_set_header X-Forwarded-Proto $scheme;
}


	location ~ /websocket$ {
		proxy_pass http://10.0.12.5:30010;
		proxy_set_header Upgrade $http_upgrade;
		proxy_set_header Connection "upgrade";
                proxy_set_header Host $host:443;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $scheme;

	}

image.png
这样就成功了:
image.png

网络上其他的解决办法是给页面头部加上:

<meta charset="utf-8" http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">

但是这样对我的问题无效。

上一篇

重置Rancher密码

Rancher密码忘记了可以通过命令重置:docker exec -it <rancher容器id> reset-password执行命令就可以看到重置后的密码了,拿到密码登陆后再修改即可。…

阅读
下一篇

sentinel流量保护作用

熔断降级什么是熔断降级由于调用关系的复杂性,如果调用链路中的某个资源出现了不稳定,最终会导致请求发生堆积。这个问题和 Hystrix 里面描述的问题是一样的。Sentinel 和 Hystrix 的原则是一致的: 当调用链路中某个资源出现不稳定,例如,表现为 timeout,异常比例升高的时候,则对…

阅读