Skip to content

Commit fefaf04

Browse files
authored
Merge pull request #14956 from nextcloud/backport/14856/stable34
[stable34] docs(security): document __Host- prefix cookie warning and how to fix it
2 parents 0db8026 + 2039853 commit fefaf04

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)