如何修复 Nextcloud Refused to send form data to /login/v2/grant because it violates the following Content Security Policy directive: form-action 'self'

问题:

尝试使用 Nextcloud 客户端连接时,在 Flow v2 授权步骤中你在浏览器中打开页面以授权客户端,你在 JS 控制台中看到类似这样的错误消息

nextcloud-form-action-error.txt
Refused to send form data to 'http://nextcloud.mydomain.com/login/v2/grant' because it violates the following Content Security Policy directive: "form-action 'self'".

解决方案

添加

config-php-snippet.php
'overwriteprotocol' => 'https',

在此行之后:

config-version-line.php
 'version' => '18.0.0.10',

在你的 nextcloud/config/config.php 中。


Check out similar posts by category: Nextcloud, PHP