Nextcloud infinite redirect loop when not using browser

Nextcloud version (eg, 10.0.2): 12.0.4
Operating system and version (eg, Ubuntu 16.04): Docker Alpine linux
Apache or nginx version (eg, Apache 2.4.25): nginx/1.13.5
PHP version (eg, 5.6): 7.1.0
Is this the first time you’ve seen this error?: Have it since a few days

Can you reliably replicate it? (If so, please outline steps):

The issue you are facing:

When trying to use any app or non browser to test connecting to the server, I seem to get an infinite loop in http redirects. The nginx log is when I use qualys ssl test to connect to the server, it works fine, except the http request has a loop in it.

The output of your Nextcloud log in Admin > Logging: None

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'datadirectory' => '/data',
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/nextcloud/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 =>
    array (
      'path' => '/nextcloud/apps2',
      'url' => '/apps2',
      'writable' => true,
    ),
  ),
  'instanceid' => 'xxx',
  'passwordsalt' => xxx',
  'secret' => xxx',
  'trusted_domains' =>
  array (
    0 => 'nextcloud.domain.tld',
  ),
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'overwrite.cli.url' => 'https://nextcloud.domain.tld',
  'dbtype' => 'mysql',
  'version' => '12.0.4.3',
  'dbname' => 'nextcloud',
  'dbhost' => 'mariadb',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mail_from_address' => 'administrator',
  'logtimezone' => 'Europe/Berlin',
  'logdateformat' => 'Y-m-d H:i:s',
  'dbuser' => 'xxx',
  'dbpassword' => 'xxx',
  'installed' => true,
  'mail_smtpmode' => 'php',
  'mail_smtpauthtype' => 'LOGIN',
  'maintenance' => false,
  'loglevel' => 2,
  'updater.release.channel' => 'stable',
  'theme' => '',
  'trusted_proxies' => ['172.17.0.0/16'],
  'overwriteprotocol' => 'https',
);

The output of your Apache/nginx/system log in /var/log/____:

172.17.0.10 - - [16/Dec/2017:20:30:06 +0100] "GET / HTTP/1.1" 302 5 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0"
172.17.0.10 - - [16/Dec/2017:20:30:07 +0100] "GET /login HTTP/1.1" 302 5 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0"
172.17.0.10 - - [16/Dec/2017:20:30:07 +0100] "GET /login HTTP/1.1" 302 5 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0"
172.17.0.10 - - [16/Dec/2017:20:30:08 +0100] "GET /login HTTP/1.1" 302 5 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0"
172.17.0.10 - - [16/Dec/2017:20:30:09 +0100] "GET /login HTTP/1.1" 302 5 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0"
172.17.0.10 - - [16/Dec/2017:20:30:10 +0100] "GET /login HTTP/1.1" 302 5 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0"

@Keridos Hey, I do have the same issue with nginx, did you manage to solve it?

I was surfing the web and this forum but found nothing. The warning is mostly shown on the results of SSLLabs test. First redirect from the bare domain to /login path and 5 (HTTP/1.1 302 Found) redirects to /login itself.

Hey, I have the same issue, but with Apache and NC 20.02. The website works great with good speeds. When I tryied SSLlabs test to check the ssl-certificate. I got http request falied.