Urgent.News

What's breaking now, across thousands of outlets.

Tech

Why Nextcloud Locked Me Out of My Own Server (and How trusted_proxies Fixed It)

TL;DR I moved a client file-sharing server from ownCloud on a reserved EC2 instance to Nextcloud on a $10 Lightsail box . Two things drove the move: the cost no longer made sense (a 1.7 GB workload sitting on a 24/7 instance, made worse by a reserved-instance commitment and a weakening yen), and the old ownCloud/OS stack had reached end-of-life. The migration itself was trivial. Two…

In order to resolve the authentication issues experienced when migrating a Nextcloud server from an EC2 instance to a $10 Lightsail box, two key fixes were required: configuring trusted proxies and adjusting the handling of the Authorization header in relation to Basic authentication.

The initial problem arose from the fact that all requests were being treated as originating from Caddy's container IP (172.18.0.2). This caused Nextcloud's brute-force protection mechanism to block the IP, resulting in the "Too many requests" error for the user. To address this issue, the trusted_proxies configuration in Nextcloud was updated to recognize the proxy IP range, allowing the system to correctly identify the client IP and prevent the IP-based locking out.

The second challenge involved a conflict between Basic authentication set up at the reverse proxy level and Nextcloud's own Authorization header handling. Initially, the addition of header_up -Authorization inside the reverse_proxy did not resolve the issue. However, moving the configuration to the site-block level, specifically in the Caddyfile, proved effective. By specifying the proxy, non-office requests should only pass through Basic authentication before being granted access to Nextcloud, the problem was resolved.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

More from Wednesday 23 September →