@@ -162,29 +162,58 @@ Pomerium
162162
163163Thanks to `@JeffMatson <https://github.com/JeffMatson >`_ for Pomerium example.
164164
165- Example
166- -------
165+ Examples
166+ --------
167167
168- Multiple domains reverse SSL proxy
169- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
168+ Nextcloud behind a reverse proxy (subdirectory)
169+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
170170
171- If you want to access your Nextcloud installation ** http://domain.tld/nextcloud **
172- via a multiple domains reverse SSL proxy
173- **https://ssl-proxy.tld/domain.tld/nextcloud ** with the IP address ** 10.0.0.1 **
174- you can set the following parameters inside the :file: `config/config.php `.
171+ If your Nextcloud is served at a subdirectory, for example
172+ ** https://example.com/nextcloud **, behind a reverse proxy with IP address
173+ **10.0.0.1 ** that terminates TLS, set the following parameters inside
174+ :file: `config/config.php `:
175175
176176::
177177
178178 <?php
179179 $CONFIG = array (
180180 'trusted_proxies' => ['10.0.0.1'],
181- 'overwritehost' => 'ssl-proxy.tld',
182181 'overwriteprotocol' => 'https',
183- 'overwritewebroot' => '/domain.tld/nextcloud',
182+ 'overwritewebroot' => '/nextcloud',
183+ 'overwrite.cli.url' => 'https://example.com/nextcloud',
184+ );
185+
186+ .. note :: ``overwritehost`` is not needed in most setups — Nextcloud will read
187+ the hostname from the ``Host `` header forwarded by the proxy. Only set it if
188+ you need to force a specific hostname regardless of the incoming request.
189+ Leave any parameter unset or empty to keep the automatic detection.
190+
191+ Nextcloud accessible via multiple domains / conditional overwrite
192+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
193+
194+ If Nextcloud is reachable both directly (HTTP) and through a reverse proxy
195+ (HTTPS), or through multiple proxies serving different public domains, use
196+ ``overwritecondaddr `` to apply the overwrite parameters only when requests
197+ arrive from a specific proxy IP address. Requests that do not originate from
198+ that proxy will use automatic detection.
199+
200+ In the example below, the overwrite parameters are applied only when requests
201+ come from the proxy at **10.0.0.1 **, which serves Nextcloud as
202+ **https://public.example.com **:
203+
204+ ::
205+
206+ <?php
207+ $CONFIG = array (
208+ 'trusted_proxies' => ['10.0.0.1'],
209+ 'overwritehost' => 'public.example.com',
210+ 'overwriteprotocol' => 'https',
184211 'overwritecondaddr' => '^10\.0\.0\.1$',
185- 'overwrite.cli.url' => 'https://domain.tld/ ',
212+ 'overwrite.cli.url' => 'https://public.example.com ',
186213 );
187214
188- .. note :: If you want to use the SSL proxy during installation you have to
189- create the :file: `config/config.php ` otherwise you have to extend the existing
190- **$CONFIG ** array.
215+ .. note :: ``overwritecondaddr`` takes a regular expression matching the remote
216+ address of the proxy. When set, the overwrite parameters are only applied if
217+ the remote address matches. This is useful when the same Nextcloud instance is
218+ accessible both with and without a reverse proxy, or when different proxies
219+ serve the instance under different hostnames.
0 commit comments