Nextcloud允许不被信任的域访问 取消 trusted domains
在服务器部署了Nextcloud,由于测试需要,经常从不同的地址访问,但是每次访问都要把域名添加到受信任域,反反复复修改也挺麻烦,暂时又没找到通配符或者禁用的方法。
不过网上提供了一个替代方法,动态生成当前访问的域名,作为受信任的域来访问Nextcloud,很方便。
打开Nextcloud的安装目录中config/config.php,给trusted_domains添加一项即可:
'trusted_domains' => array(
0 => '127.0.0.1',
1=>preg_match('/cli/i',php_sapi_name())?'127.0.0.1':$_SERVER['SERVER_NAME'],
),
问了AI,说把上面整段代码注释掉就可以了,亲测无效。
不过下面这个也是AI给出的类似答案,简单多了。
-----------------
Nextcloud has been deployed on the server. Due to testing requirements, it is frequently accessed from different addresses. However, it is cumbersome to manually add the domain to the trusted domains list every time, and I haven't found a wildcard or disable method yet.
Fortunately, there is an alternative method available online. By dynamically generating the current accessed domain, it can be added as a trusted domain to access Nextcloud conveniently.
To implement this, open the config/config.php file in the installation directory of Nextcloud and add the following line to the trusted_domains array:
'trusted_domains' => array(
// 0 => '127.0.0.1',
0 => $_SERVER['HTTP_HOST'], //根据AI回答得到的更方便的语句,比百度别人的那个简单多了,
),
By doing this, the code will dynamically add the currently accessed domain to the trusted_domains array each time, eliminating the need for manual modifications.
Please make sure to backup the config.php file before making any changes to avoid any unexpected issues. I hope this method helps! If you have any further questions, feel free to ask.
Nextcloud允许不被信任的域访问 取消 trusted domains的更多相关文章
- 【AngularJs】---JSONP跨域访问数据传输
大家会自然想到只有一个字母之差的JSON吧~ JSON(JavaScript Object Notation)和JSONP(JSON with Padding)虽然只有一个字母的差别,但其实他们根本不 ...
- IE 将“通过域访问数据源”设置为启用(注册表)
XP HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\1\1406 Vista+ HKCU\Softwar ...
- [Unity WWW] 跨域访问解决方法
什么是跨域访问 域(Domain)是Windows网络中独立运行的单位,域之间相互访问则需要建立信任关系(即Trust Relation).信任关系是连接在域与域之间的桥梁.当一个域与其他域建立了信任 ...
- 跨域访问http接口的使用
最近在弄一个sip网页集成版软电话,为了功能的完善,呼叫中心的工作人员为我们提供了一个http接口,我先在网页中直接打开分析了一下他的返回值,然后又放到js中去访问,结果一放到js中一访问就发现浏览器 ...
- Android WebView存在跨域访问漏洞(CNVD-2017-36682)介绍及解决
Android WebView存在跨域访问漏洞(CNVD-2017-36682).攻击者利用该漏洞,可远程获取用户隐私数据(包括手机应用数据.照片.文档等敏感信息),还可窃取用户登录凭证,在受害者毫无 ...
- Javascript 跨域访问解决方案 总结
在客户端编程语言中,如javascript和ActionScript,同源策略是一个很重要的安全理念,它在保证数据的安全性方面有着重要的意义.同 源策略规定跨域之间的脚本是隔离的,一个域的脚本不能访问 ...
- 【AngularJs】---JSONP跨域访问数据传输(JSON_CALLBACK)
大家会自然想到只有一个字母之差的JSON吧~ JSON(JavaScript Object Notation)和JSONP(JSON with Padding)虽然只有一个字母的差别,但其实他们根本不 ...
- 解决cookie跨域访问
一.前言 随着项目模块越来越多,很多模块现在都是独立部署.模块之间的交流有时可能会通过cookie来完成.比如说门户和应用,分别部署在不同的机器或者web容器中,假如用户登陆之后会在浏览器客户端写入c ...
- Angular2中对ASP.NET MVC跨域访问
应用场景 项目开发决定使用angular2进行前后端分离开发,由我负责后端服务的开发,起初选择的是web api进行开发.对跨域访问通过API中间件+过滤器对跨域访问进行支持.开发一段后,通知需要移植 ...
- jquery ajax在跨域访问post请求的时候,ie9以下无效(包括ie9)
1. 设置浏览器安全属性,启用[通过域访问数据源]选项,如图:
随机推荐
- 【LeetCode动态规划#11】打家劫舍系列题(涉及环结构和树形DP的讨论)
打家劫舍 力扣题目链接(opens new window) 你是一个专业的小偷,计划偷窃沿街的房屋.每间房内都藏有一定的现金,影响你偷窃的唯一制约因素就是相邻的房屋装有相互连通的防盗系统,如果两间相邻 ...
- 迁移学习(MEnsA)《MEnsA: Mix-up Ensemble Average for Unsupervised Multi Target Domain Adaptation on 3D Point Clouds》
论文信息 论文标题:MEnsA: Mix-up Ensemble Average for Unsupervised Multi Target Domain Adaptation on 3D Point ...
- Spring 之bean的生命周期
文章目录 IOC Bean的生命周期 运行结果 实例演示 实体类 实例化前后置代码 初始化的前后置代码 application.xml 总结 今天我们来聊一下Spring Bean的生命周期,这是一个 ...
- cryptohack wp day(1)
就从头开始吧 第一题 (ASCII) 一道简单的ASCII码转换,直接用题目的提示代码解就行了 ascii=[99, 114, 121, 112, 116, 111, 123, 65, 83, 67, ...
- 修改mysql的密码时遇到问题ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corre
先输入:flush privileges; 再输入:ALTER USER 'root'@'localhost' IDENTIFIED BY 'mysql'; 再输入:flush privileges刷 ...
- [Flink] Flink Job运行状态正常,但日志中偶报“FlinkException: The file LOG does not exist on the TaskExecutor.”
0 序言 Flink : 1.12 job start running time : 2022-12-27 17:40:47 problem throw time : 2023-05-11 16:41 ...
- [OS/Linux] Linux核心参数:net.core.somaxconn(高并发场景核心参数)
0 序言 近期工作在搞压力测试,我负责开发维护的.基于sring-cloud-gateway的大数据网关微服务,其底层是基于spring-webflux-->reactor-netty--> ...
- sh: vue-cli-service: command not found
mac环境下运行vue项目报错sh: vue-cli-service: command not found 解决方法:cd到项目目录下,执行命令sudo rm -rf node_modules pac ...
- 2020-09-15:java里的wait()和sleep()的区别有哪些?
福哥答案2020-09-15:#福大大架构师每日一题# 1.线程状态.wait()的线程状态是TimedWaiting和Waiting.sleep()的线程状态是Waiting.2.指定时间.wait ...
- pages.json 文件:globalStyle 全局配置
globalStyle 用于设置应用的状态栏.导航条.标题.窗口背景色等. 属性 类型 默认值 描述 平台差异说明 navigationBarBackgroundColor HexColor #F7F ...