ERR_TOO_MANY_REDIRECTS with Nextcloud when force SSL and Cloudflare tunnel enabled

80 views Asked by At

I am trying to setup Nextcloud on my Unraid server. I am using my own domain, Cloudflare to manage my DNS records and Nginx Proxy Manager to reverse proxy.

I am used to setting up reverse proxies (I have it working just fine with several apps). However, when setting up Nextcloud, I encounter a strange thing that I cannot figure out where it is comming from.

I am following SpaceInvaderOne's tutorial for the installation and basically I manage to correctly install Nextcloud but when enabling the Force SSL and HSTS settings in NPM, I get the ERR_TOO_MANY_REDIRECTS on reload. What I have also noticed is that when I disable the Proxy setting in Cloudflare and leave it in DNS Only, it now works with the Force SSL And HSTS enabled.

So my guess is that I am doing something wrong with the DNS and SSL but cannot figure it out. In short I can either disable Force SSL and HSTS (and go against the recommandation in Nextcloud) or leave my DNS record in DNS Only in cloudflare (and having my IP out there).

Should I change some settings in my nextcloud config.php or something like this?

Here is my config.php file:

<?php
$CONFIG = array (
  'datadirectory' => '/data',
  'instanceid' => '......',
  'passwordsalt' => '......',
  'secret' => '......',
  'trusted_domains' => 
  array (
    0 => '192.168.1.56:444',
    1 => 'nextcloud.mydomain.ext',
  ),
  'default_phone_region' => 'FR',
  'dbtype' => 'mysql',
  'version' => '28.0.1.1',
  'overwrite.cli.url' => 'https://nextcloud.mydomain.ext/',
  'overwritehost' => 'nextcloud.mydomain.ext',
  'overwriteprotocol' => 'https',
  'dbname' => 'nextcloud_db',
  'dbhost' => '192.168.1.56:3306',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud_user',
  'dbpassword' => '......',
  'installed' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'filelocking.enabled' => true,
  'memcache.locking' => '\\OC\\Memcache\\APCu',
  'upgrade.disable-web' => true,
);

And my NPM settings:

NPM settings1 NPM settings2

0

There are 0 answers