Skip to content

Commit 2fd0041

Browse files
skjnldsvbackportbot[bot]
authored andcommitted
docs(security): add __Host- prefix cookie warning explanation
Admins seeing this warning from the security scanner had no obvious place to look for a fix. Add a dedicated section to the security setup warnings page explaining what the prefix does, why it may be missing (reverse proxy terminating TLS), and how to resolve it via overwriteprotocol in config.php. Cross-references the existing cookies.rst page for background. Fixes #377 Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
1 parent c593c01 commit 2fd0041

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

admin_manual/configuration_server/security_setup_warnings.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,31 @@ Your database does not run with "READ COMMITTED" transaction isolation level
133133
This can cause problems when multiple actions are executed in parallel."
134134

135135
Please refer to :ref:`db-transaction-label` how to configure your database for this requirement.
136+
137+
The "__Host-" prefix is not used for the cookie name
138+
-----------------------------------------------------
139+
140+
"The ``__Host-`` prefix is not used for the cookie name. It is recommended to
141+
enable this in your configuration."
142+
143+
Nextcloud applies the ``__Host-`` prefix to its same-site CSRF cookies
144+
(``__Host-nc_sameSiteCookiestrict`` and ``__Host-nc_sameSiteCookielax``) when
145+
it detects that the connection is served over HTTPS. The prefix instructs
146+
browsers to only accept those cookies over a secure connection and from the
147+
exact host that set them, which strengthens CSRF protection.
148+
149+
This warning appears when Nextcloud cannot confirm it is running over HTTPS.
150+
The most common cause is a **reverse proxy** that terminates TLS and forwards
151+
requests to Nextcloud over plain HTTP. In that case Nextcloud sees HTTP
152+
internally and omits the prefix.
153+
154+
To fix this, tell Nextcloud to treat the connection as HTTPS by adding
155+
``overwriteprotocol`` to ``config/config.php``::
156+
157+
'overwriteprotocol' => 'https',
158+
159+
If you are not behind a reverse proxy, ensure your web server is configured to
160+
serve Nextcloud exclusively over HTTPS. See the
161+
:ref:`use_https_label` documentation.
162+
163+
For background on the cookies themselves, see :ref:`cookies`.

0 commit comments

Comments
 (0)