Problems & Solutions

Problems & Solutions

Troubleshooting: Nextcloud Login Hangs (Requires Manual Refresh to Access Dashboard)

📌 Problem Description

After entering valid user credentials on the Nextcloud login page, the loading spinner spins indefinitely. The user is not automatically redirected to the dashboard. However, if the user manually refreshes the browser page, the dashboard loads instantly, confirming that the login session was successfully created in the background.

🔍 Root Cause

This issue typically occurs when Nextcloud is deployed behind a reverse proxy (e.g., Nginx Proxy Manager, Cloudflare Tunnels, Traefik, Apache).

  1. Protocol Mismatch: Nextcloud fails to recognize that the client is connecting securely via https:// and defaults to generating internal redirect URLs using insecure http://.
  2. Mixed Content Block: Modern web browsers block this redirect because switching from HTTPS to HTTP violates security policies.
  3. Throttling: Nextcloud treats the unrecognized proxy connections as a potential brute-force attack, throttling the response speed.

🛠️ Solution

To resolve this, Nextcloud must be forced to use HTTPS for all internal links, and the reverse proxy's network address must be whitelisted.

Step 1: Force HTTPS Protocol Overwrites

Open your Nextcloud installation directory and edit the main configuration file located at config/config.php. Add or update the following configuration strings:

  'overwrite.cli.url' => 'https://your-nextcloud-domain.com',
  'overwriteprotocol' => 'https',

Note: Replace https://your-nextcloud-domain.com with your actual external domain name. The overwriteprotocol line is usually missing by default and must be explicitly added.

Step 2: Configure Trusted Proxies

In the same config/config.php file, locate or create the trusted_proxies array. Add the internal IP address of your reverse proxy to this list.

  'trusted_proxies' => array(
    0 => '127.0.0.1',
    1 => '172.18.0.1', // Example: Internal Docker network gateway
    2 => '192.168.1.50', // Example: Standalone reverse proxy LAN IP
  ),

How to find your Proxy IP:

Step 3: Apply & Verify

  1. Save the changes to config/config.php.
  2. Clear your web browser cache or open a private/incognito window.
  3. Log out of Nextcloud and log back in. The redirect from the login panel to the dashboard should now happen instantly.