// troubleshooting guide · nextcloud

Nextcloud Access Through Untrusted Domain Error

Status
Workaround available
platforms:
Self-hosted (Docker, TrueNAS, Linux)
updated:
November 16, 2026
reports:
4
Method
how we research
Share

RUNBOOK · nextcloud/access-through-untrusted-domain4 FIXES

// quick answer

Nextcloud refuses requests whose hostname is not in trusted_domains. Add the domain or IP to config.php (or via occ), and behind a reverse proxy also set trusted_proxies and overwrite settings.

Most likely fix: Add the domain with occ

How to fix it

// try these in order, the most common fix is first

  1. FIX 1Add the domain with occ

    1. 01Run: sudo -u www-data php occ config:system:set trusted_domains 1 --value=cloud.example.com
    2. 02Reload the page using exactly that hostname
    Did this fix it?
  2. FIX 2Edit config.php

    1. 01Open config/config.php
    2. 02Add the host or IP to the trusted_domains array
    3. 03Save and reload
    Did this fix it?
  3. FIX 3Configure the reverse proxy

    1. 01Add the proxy IP to trusted_proxies in config.php
    2. 02Set 'overwriteprotocol' => 'https' and overwritehost to your public host
    3. 03Use overwritecondaddr if the server is also reachable directly
    4. 04If redirect loops appear, test with and without overwriteprotocol
    Did this fix it?
  4. FIX 4Check Docker env vars

    1. 01Open the container's config.php and confirm every domain is present
    2. 02Add missing entries manually if the env var only applied the first one
    Did this fix it?

Symptoms

Opening Nextcloud shows 'Access through untrusted domain' or a redirect/encoding error, often after installing in Docker, TrueNAS or putting a reverse proxy in front.

Why it happens

  • C-01The hostname or IP is missing from trusted_domains in config.php
  • C-02Reverse proxy not listed in trusted_proxies
  • C-03overwriteprotocol or overwritehost not set for the proxy
  • C-04NEXTCLOUD_TRUSTED_DOMAINS env var applied only partly in a container

// this guide also covers

  • nextcloud access through untrusted domain
  • nextcloud trusted domain error
  • nextcloud reverse proxy untrusted domain

Still not working?

If Nextcloud keeps failing, you're not alone. See every Nextcloud problem users report or the alternatives people switch to.

Have an app idea? Our small team builds any software: web and mobile apps, games, desktop, AI tools. Price agreed together.

Talk to us

Watch Nextcloud Get an email when its price changes, it has an outage, or we publish a new fix. No spam.

Fixed it? Share this guide

The same problem in other apps

All not loading, error messages & connection guides →

Other Nextcloud errors

All 10 Nextcloud errors and fixes →