How to Fix Nextcloud IP Detection and HSTS Headers Behind Traefik and Cloudflare
A developer documented two key configuration issues encountered while hardening Nextcloud 29 running in Docker on a Proxmox LXC behind Traefik v3 and a Cloudflare Tunnel. The first problem involved Nextcloud misidentifying all client IPs as Traefik's IP, breaking brute-force protection and rate limiting, which was resolved by setting trusted proxies and Cloudflare CIDRs via the occ command-line tool. The second issue was that Traefik's built-in HSTS middleware failed to send Strict-Transport-Security headers because Cloudflare terminates TLS before traffic reaches Traefik, causing it to treat connections as non-HTTPS. The fix required adding an explicit custom response header in Traefik's dynamic configuration rather than relying on the stsSeconds directive. Additional hardening steps included setting a maintenance window, defining a default phone region, and installing apps such as Calendar, Contacts, and Talk directly via occ instead of the web UI.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in