Err_too_many_redirects Nextcloud BM

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can. :heart:

The Basics

  • Nextcloud Server version : 30.0.5
  • Operating system and version :
    • Ubuntu 24.04
    • Web server and version
    • Apache 2.4.58
  • Reverse proxy and version
    -NGINX Proxy Manager
  • PHP version :
  • 8.3
  • Is this the first time you’ve seen this error?:
  • Yes :
  • When did this problem seem to first start?
    • When i needed NGINX Proxy Manager.
  • Installation method :
  • Bare Metal
  • Are you using CloudfIare, mod_security:
  • Cloudflace - Proxy OFF

Locally the website works https://nc.mydomain.eu

It also works over VPN Wireguard which is installed on the same machine.

Another machine runs Nginx Proxy manager. NPM is on 192.168.1.5

A proxy rule was made to nc.mydomain.eu with SSL/HTTP-2/HSTS/HSTS subdomains. :80(also tried :443)
Other things work fine so i know NPM is working for example ‘minecraft.mydomain.eu’ opens the management interface.

When i use my phone (Wifi/vpn off) Chrome/Chrome beta/Brave/Opera i get ‘ERR_TOO_MANY_REDIRECTS’

.htaccess is setup and used to work before NPM was installed, when i forward the ports back to Apache2/nextcloud it works again.

I checked SSL logs on apache2 and on NPM. There isn’t much there
Most searches for ‘.htaccess’ configuration ended up with nothing working at all and were related to WP.
I check with : https://httpstatus.io/

If any more logs are needed please let me know.

Apache2 error.log (this apparently should be normal?) :

[Sat Jan 25 00:00:01.646000 2025] [core:notice] [pid 309543:tid 123292967192448] AH00094: Command line: '/usr/sbin/apache2'
[Sat Jan 25 16:59:56.058343 2025] [access_compat:error] [pid 321738:tid 123292604171968] [client ::1:45804] AH01797: client denied by server configuration: /var/www/nextcloud/data/.ncdata
[Sat Jan 25 16:59:56.409188 2025] [access_compat:error] [pid 321737:tid 123292237170368] [client 127.0.0.1:55506] AH01797: client denied by server configuration: /var/www/nextcloud/data/.ncdata
[Sat Jan 25 16:59:56.540040 2025] [access_compat:error] [pid 321738:tid 123292448982720] [client 192.168.1.2:32800] AH01797: client denied by server configuration: /var/www/nextcloud/data/.ncdata

These are all the things i tried.

Tried in nextcloud config.php:

<?php
$CONFIG = array (
  'trusted_proxies'   => ['192.168.1.5'],
  'overwritehost'     => 'nc.mydomain.eu',
  'overwriteprotocol' => 'https',
  'overwritewebroot'  => '/nextcloud',
  'overwritecondaddr' => '^192\.168\.1\.5$',
  'overwrite.cli.url' => 'https://nc.mydomain.eu/,
);

Tried changing /var/www/nextcloud/.htaccess

RewriteEngine on
rewritecond %{http_host} ^mydomain.eu [nc]
rewriterule ^(.*)$ http://nc.mydomain.eu/$1 [r=301,nc]

I’m not sure if that’s correct at all since it’s https.

Same for this:

#301 redirect
 RewriteCond %{HTTP_HOST} ^nc.mydomain.eu$ [NC]
 RewriteRule ^(.*)$ http://nc.mydomain.eu/$1 [R=301,L]

 #https
  RewriteCond %{HTTPS} off
  RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

  #remove home
  RewriteCond %{THE_REQUEST} ^.*/home
  RewriteRule ^(.*)home$ https://nc.mydomain/$1 [R=301,L] 


 # !IMPORTANT! Set your RewriteBase here and don't forget trailing and leading
 #  slashes.
 # If your page resides at
 #  http://nc.mydomain.eu/
 # then use
 # RewriteBase /
 #RewriteBase /
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule ^(.*)$ index.php?/$1 [L]

Also tried :

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule - https://%{HTTP_HOST}%{REQUEST_URI} [QSA,L,R=301]

I don’t know what else to do really hoping someone has the answer.

This is my .htaccess bottom part.

#### DO NOT CHANGE ANYTHING ABOVE THIS LINE ####

ErrorDocument 403 //index.php/error/403
ErrorDocument 404 //index.php/error/404
<IfModule mod_rewrite.c>
 Options -MultiViews
 RewriteRule ^core/js/oc.js$ index.php [PT,E=PATH_INFO:$1]
 RewriteRule ^core/preview.png$ index.php [PT,E=PATH_INFO:$1]   
 RewriteCond % REQUEST_FILENAME}!\.css|js|mjs|svg|gif|ico|jpg|jpeg|png|webp|html|otf|ttf|woff2?|map|webm|mp4|mp3|ogg>
 RewriteCond %{REQUEST_FILENAME} !/core/ajax/update\.php
 RewriteCond %{REQUEST_FILENAME} !/core/img/(favicon\.ico|manifest\.json)$
 RewriteCond %{REQUEST_FILENAME} !/(cron|public|remote|status)\.php
 RewriteCond %{REQUEST_FILENAME} !/ocs/v(1|2)\.php
 RewriteCond %{REQUEST_FILENAME} !/robots\.txt
 RewriteCond %{REQUEST_FILENAME} !/(ocs-provider|updater)/
 RewriteCond %{REQUEST_URI} !^/\.well-known/(acme-challenge|pki-validation)/.*
 RewriteCond %{REQUEST_FILENAME} !/richdocumentscode(_arm64)?/proxy.php$
 RewriteRule . index.php [PT,E=PATH_INFO:$1]
 RewriteBase /
 <IfModule mod_env.c>
   SetEnv front_controller_active true
   <IfModule mod_dir.c>
     DirectorySlash off
    </IfModule>
  </IfModule>
 </IfModule>

Here’s my Nextcloud-le-ssl.conf (changed URLS)

<IfModule mod_ssl.c>
<VirtualHost *:443>
  DocumentRoot /var/www/nextcloud/
  ServerName  nc.mydomain.eu

  <Directory /var/www/nextcloud/>
    Satisfy Any
    Require all granted
    AllowOverride All
    Options FollowSymLinks MultiViews

# Encoded slashes need to be allowed
#AllowEncodedSlashes NoDecode

# Container uses a unique non-signed certificate
#SSLProxyEngine On
#SSLProxyVerify None
#SSLProxyCheckPeerCN Off
#SSLProxyCheckPeerName Off

# keep the host
#ProxyPreserveHost On

# static html, js, images, etc. served from coolwsd
# browser is the client part of LibreOffice Online
#ProxyPass           /browser https://127.0.0.1:9980/browser retry=0
#ProxyPassReverse    /browser https://127.0.0.1:9980/browser

# WOPI discovery URL
#ProxyPass           /hosting/discovery https://127.0.0.1:9980/hosting/discovery retry=0
#ProxyPassReverse    /hosting/discovery https://127.0.0.1:9980/hosting/discovery

# Main websocket
#ProxyPassMatch "/cool/(.*)/ws$" wss://127.0.0.1:9980/cool/$1/ws nocanon

# Admin Console websocket
#ProxyPass   /cool/adminws wss://127.0.0.1:9980/cool/adminws

# Download as, Fullscreen presentation and Image upload operations
#ProxyPass           /cool https://127.0.0.1:9980/cool
#ProxyPassReverse    /cool https://127.0.0.1:9980/cool

# Endpoint with information about availability of various features
#ProxyPass           /hosting/capabilities https://127.0.0.1:9980/hosting/capabilities retry=0
#ProxyPassReverse    /hosting/capabilities https://127.0.0.1:9980/hosting/capabilities
    <IfModule mod_dav.c>
      Dav off
    </IfModule>

    <IfModule mod_headers.c>
      Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
    </IfModule>
  </Directory>

SSLCertificateFile /etc/letsencrypt/live/nc.mydomain.eu/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/nc.mydomain.eu/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf



</VirtualHost>
</IfModule>

If someone manages to read all the way to here, thank you very much.
I got really frustrated trying to just ask a question here.

You mean, your issue is solved?

No Collabora is ok now since it’s gone. OnlyOffice worked without any issues.

The ‘ERR_TOO_MANY_REDIRECTS’ is still there. Sorry for the mixup.

That issue seems to be really hard to solve (or i’m just to stupid to understand it).

I removed the info on that since it’s no longer needed. If i’d known onlyoffice was this much simpler…

Well this is weird. I uninstalled collabora from my nextcloud installation. Removed to collabora docker and suddenly the error is gone?

So my too_many_redirects seemed to have been caused by collabora?

Not saying I’m not happy it works … however I still have no idea how it caused the issue… I couldn’t find any mention in my logs that collabora was causing issues…

So I guess it’s solved now. Now I just want ONLYOFFICE to allow mobile editor without paying 140usd a year. It’s not something I use weekly.
@wbk I kinda want to know why or how collabora caused the issues…

I recognize the feeling; it seems unfair that the issue got away without being resolved.

Without your patient there to operate on, it’s hard to diagnose the problem.

You may have noticed that searching for “docker too many redirects” in general, outside of Nextcloud, gives quite a few results and possible causes.

That being the case, congratulations still on your working installation!

As for mobile editing, does ONLYOFFICE not allow editing in Nextcloud?

Yeah, collabora was giving random issues. 1 moment it was connected in administrative panel. Wait a few seconds and it went red again. Click “save” and it was connected again.

My nextcloud installation is bare metal and collabora was running in docker with https enabled. It could be related to nginx proxy manager but I honestly don’t know.
When I forwarded 80/443 back to nextcloud again there were no issues.

I don’t know how to go about this. I don’t like nextcloud in docker or snap. But I’m not sure how to setup nginx and nextcloud on the same machine. NPM is running on a different machine now which has 80/443 forwarded to it.

And in all fairness I’m no pro with docker. The whole port thing has me confused. When to use bridge or host network. Why some docker containers can’t be moved to host network or won’t be accessible on the ports exposed.

I’ve read tons of material, watched tons of videos but where it’s easy for me to follow in VMware esxi I can’t get my head around it on docker.

There’s a reason that docker-management panels with plug&play apps are popular :slight_smile:

You could consider renting a cheap VPS (don’t pay more than 15 euro per year when just testing) to try out NPM and its effects on routing between simple static websites.

In due time, you may test the waters once more with Collabora on your Nextcloud server.

Good you got it solved for now!

I do have enough hardware at home to test such things. I’ve got about 15 dell optiplex machines laying around and some super micro servers and some other xeon machines. The foundation has to be correct. Currently I’m rebuilding my network (slowly) already got windows server 2025 with ad/DC/dns/dhcp running and probably ac services soon. Haven’t switched yet it runs on a network with a different router.

Then I need to rebuild my Nas but having storage space issues to deal with, need to store roughly 25TB somewhere before I can use the disks again.

I want to switch my Nas currently windows 11 pro for workstations to truenas scale. Still thinking about what to run where.

I also got a updated and running esxi 8.0 server that hosts about 20VMs that runs fine (but loud and power hungry).

I want to turn DHCP off on my router and let windows server 2025 do that. Make everything connect to that but still working to get the user directory’s working so installed programs go with the logins.

But also the windows server DNS has to go through Adguard and wireguard has to work also which currently runs on the same machine that hosts nextcloud. Yes I know it’s kinda messy.

I also have a layer 3 switch from juniper (ex4200 48T) which can do amazing things but it’s been so long I need to get into that again.

I just want it to work well and balanced out.

1 server ubuntu+docker+NPM+Adguard+wireguard+nextcloud+ONLYOFFICE (modded version) but configuring this port wise is hard for me.

That is quite a nice set!

Yes, I agree. Still, starting with nothing it is easier to “just start” and incrementally improve things, perhaps redoing parts that turned out to be a bad choice in hindsight.

If you don’t have responsibility for the continuity of a business running on that hardware, it is easier to just wipe servers that, again in hindsight, should have been configured differently.

I can wholeheartedly suggest to start with some plug-and-play install of Wordpress on a more power efficient device with easy backup options, and make notes of the steps you took.

Nextcloud of course has all kinds of nice apps to offer just such things, but it has to run first and is a bit more complex than vanilla Wordpress.

Besides VMware, you could have a look into Proxmox, if you have not done so yet. It runs perfectly well on any device that will run an AMD64 flavour of Debian, and works with all hardware that Debian recognizes. Combining a few of your servers it offers nice fail over options, and there is a matching backup solution (PBS, “Proxmox backup server”).

I’m quite enthousiast about it (as probably more people on this and other fora). My Nextcloud runs in an LXC container on Proxmox, with hardly a hiccup with quite a few Proxmox, Debian and Nextcloud upgrades in between.

Nextcloud + collabora got installed via Yunohost, a self-hosting platform for Debian, working with full app installs (as opposed to containerized apps). If you got some hardware to spare, give it a try!