HTTP status code Request failed (Too many Redirection)

Hello,

I’ve managed to set up my new nextcloud server and everything works as expected.
I’m trying to harden my nc instalation so I’ve configured using cloudflare and I’m getting an A+ from ssl labs and also from scan.nextcloud.com same A+ but from ssl labs I’m getting this error : HTTP status code Request failed (Too many Redirection)

I’ve seen that in my nextcloud instalation in config.php if i’m removing the line(i don’t remember if that’s the exact line but it’s similar to redirection) redirect => https I’m not getting this erro when testing my server using ssl labs but then scan.nextcloud.com it’s complaining about _Prefix cockies something then from A+ I’m getting A without +.
My instalation it’s running on ubuntu 20.04 , with apache and everything was installed manually.
Then in front of my cloud.example.com host I’ve installed an nginx proxy , because I’ve got also another website so to be able to serve both. Then everything goes back like i’ve mentioned using nextcloud FULL STRICT mode. The nextcloud instalation works okay, but I don’t know how to fix this error with HTTP request, does anyone has any idea ?

I’m looking forward to hearing from you when possible.

Regards

Can anyone help me on this, please?

Thnaks.

We’ll need a little more information. Please post your nextcloud config.php file and NGINX conf file being sure to anonymize where necessary.

I’ve got a reverse proxy so this is my nginx virtual host config :

upstream cloud {
  server 10.8.0.2:80;
}

server {
        server_name cloud.example.com;

    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;

    location / {

 location = /.well-known/carddav {
      return 301 /remote.php/dav;
  }
  location = /.well-known/caldav {
      return 301 /remote.php/dav;
  }

      add_header X-Served-By "My Servlet Handler";
      add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
      proxy_set_header        Host $host:$server_port;
      proxy_redirect off;
      proxy_set_header        X-Real-IP $remote_addr;
      proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header        X-Forwarded-Proto $scheme;
      proxy_pass http://cloud;
      add_header Pragma "no-cache";
    }


    client_max_body_size 10240m;


    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/cloud.example.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/cloud.example.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}



server {
    if ($host = cloud.example.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


        server_name cloud.example.com;
    listen 80;
    return 404; # managed by Certbot


}

then my nextcloud config.php looks like this :

<?php
$CONFIG = array (
  'instanceid' => 'instanceid',
  'passwordsalt' => 'passwordsalt',
  'secret' => 'secret',
  'trusted_proxies' =>
  array (
    0 => '10.8.0.1',
  ),
  'trusted_domains' =>
  array (
    0 => 'cloud.example.com',
  ),
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => 'localhost',
    'port' => 6379,
    'timeout' => 0,
  ),
  'default_phone_region' => 'UK',
  'overwriteprotocol' => 'https',
  'tempdirectory' => '/nextcloud_data/nextcloud_tmp',
  'datadirectory' => '/nextcloud_data',
  'dbtype' => 'pgsql',
  'version' => '22.2.3.0',
  'dbname' => 'nextclouddb',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'dbuser',
  'dbpassword' => 'dbpassword',
  'installed' => true,
  'mail_smtpmode' => 'smtp',
  'mail_smtpauth' => 1,
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => 'cloud',
  'mail_domain' => 'example.com',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtphost' => 'aus.mx.com',
  'mail_smtpport' => '587',
  'mail_smtpsecure' => 'tls',
  'mail_smtpname' => 'cloud@example.com',
  'mail_smtppassword' => 'myverysecretpassword',
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
  'overwrite.cli.url' => 'http://cloud.example.com:443',
);

if i’m testing my website using ssllabs[dot]com it’s showing as being A+ but at the end of the page I’m getting this :
HTTP request to this server failed, see below for details.
and
HTTP status code Request failed (Too many Redirection)

Hello,

Sorry to keep going back to this issue. Is there someone who can please have a look and help me on this matter?

Thank you.

Hey @dimostin any progress on this?
I’m facing the same issue.

hey @bloo sorry about my delayed response.
Unfortunately I haven’t managed to get a real fix on this matter.
So what I did at this point in time was to do a clean re-install and I’ve used the nginx config file recommended on the nextcloud website and everything seems to be working as expected.