Nextcloud version (eg, 20.0.5): 22.2.5
Operating system and version (eg, Ubuntu 20.04): Debian 10
Apache or nginx version (eg, Apache 2.4.25): nginx (reverse proxy), apache (local)
The issue you are facing:
I try to configure my nextcloud instance to make it accessible by multiple domains. (With just one domain everything works like expected)
For that I added a new site to my nginx reverse proxy (to provide a ssl certificate for the new domain). The nginx reverse proxy ip address and internal domain name are entries of “trusted_domains” in config.php
As soon as I access my nextcloud via the new domain (domain 2) it gets rewritten to the other one (the first one I’ve configured - domain 1). The reason for that is the “overwritehost” option in my config.php file which is needed that I can access my nextcloud via a reverse proxy with domain 1.
Is there a possibility to make my nextcloud accessible without the need of overwriting the host?
Or can it be configured in that way that the url gets overwritten with domain 1 if I access it via this domain and to domain 2 if I use the new one (e.g. like the client ip address via x-forwarded-for header)?
As soon as I remove the overwritehost and add domain 1 and domain 2 to the “trusted_domains” I get the error:
“Access through untrusted domain”
I get the same error as well if I remove the second domain and just use the first one. So this setting is needed to be able to access my nextcloud instance via my reverse proxy.
Thank you for your help