Endless redirect (302) given back from index.php

Dear all,

I had my owncloud migrated some time ago to nextcloud.
It is running on FreeBSD and worked for quiet a while perfectly fine.
But it stopped working and I’m not able to pin it to a fixed date/time. The problem could be related to an update in the system (haproxy, apache, php, nextcloud or whatever nextcloud is using).
The installed nextcloud version is 9.0.51 (current version on FreeBSD).

If I try to access the login page of nextcloud it is working perfectly fine.
If I login it does an infite redirect.
If I manually remove the cookie in the browser it will represent the login page again.

I checked the logfile from php-fpm and I see:
127.0.0.1 - 16/Jul/2016:10:35:05 +0200 "GET /index.php/apps/files/" 302 /usr/local/www/nextcloud/index.php 312.292 8704 95.06% 127.0.0.1 - 16/Jul/2016:10:35:05 +0200 "GET /index.php/apps/files/" 302 /usr/local/www/nextcloud/index.php 54.437 8192 100.46% 127.0.0.1 - 16/Jul/2016:10:35:06 +0200 "GET /index.php/apps/files/" 302 /usr/local/www/nextcloud/index.php 51.760 8192 105.66% 127.0.0.1 - 16/Jul/2016:10:35:06 +0200 "GET /index.php/apps/files/" 302 /usr/local/www/nextcloud/index.php 50.804 8192 107.64% 127.0.0.1 - 16/Jul/2016:10:35:06 +0200 "GET /index.php/apps/files/" 302 /usr/local/www/nextcloud/index.php 49.902 8192 93.93% 127.0.0.1 - 16/Jul/2016:10:35:06 +0200 "GET /index.php/apps/files/" 302 /usr/local/www/nextcloud/index.php 49.731 8192 94.26% 127.0.0.1 - 16/Jul/2016:10:35:06 +0200 "GET /index.php/apps/files/" 302 /usr/local/www/nextcloud/index.php 49.928 8192 109.53% 127.0.0.1 - 16/Jul/2016:10:35:07 +0200 "GET /index.php/apps/files/" 302 /usr/local/www/nextcloud/index.php 49.723 8192 94.27% 127.0.0.1 - 16/Jul/2016:10:35:07 +0200 "GET /index.php/apps/files/" 302 /usr/local/www/nextcloud/index.php 50.181 8192 108.98% 127.0.0.1 - 16/Jul/2016:10:35:07 +0200 "GET /index.php/apps/files/" 302 /usr/local/www/nextcloud/index.php 50.658 8192 92.53% 127.0.0.1 - 16/Jul/2016:10:35:07 +0200 "GET /index.php/apps/files/" 302 /usr/local/www/nextcloud/index.php 51.085 8192 107.05%

All other sites on the server are working fine, so I’m not sure if that problem is really related to the server configuration.
Does anyone have an idea why nextcloud is make is infite redirect (302)?

The config.php (i replaced some parts with x):
`<?php
$CONFIG = array (
‘instanceid’ => ‘x’,
‘passwordsalt’ => ‘x’,
‘datadirectory’ => ‘/usr/local/clouddata’,
‘dbtype’ => ‘mysql’,
‘version’ => ‘9.0.51.0’,
‘dbname’ => ‘owncloud’,
‘dbhost’ => ‘localhost’,
‘dbtableprefix’ => ‘oc_’,
‘dbuser’ => ‘owncloud’,
‘dbpassword’ => ‘x’,
‘installed’ => true,
‘forcessl’ => true,
‘loglevel’ => 0,
‘theme’ => ‘’,
‘maintenance’ => false,
‘trusted_domains’ =>
array (
0 => ‘owncloud.x.net’,
1 => ‘owncloud.x.lan’,
2 => ‘owncloud.x.org’,
3 => ‘nextcloud.x.net’,
4 => ‘cloud.x.net’,
),
‘secret’ => ‘x’,
‘debug’ => true,
‘trashbin_retention_obligation’ => ‘auto’,
‘memcache.local’ => ‘\OC\Memcache\APCu’,
);

`

Hmmm… I’m not sure, but I’d probably start off by looking at the .htaccess files to see what rules trigger a 302…

I checked it, but there is now rule in that triggers a 302 (it is the standard one coming with nextcloud).
What I do not like are these lines:
`127.0.0.1 - 17/Jul/2016:13:44:20 +0200 “GET /status.php” 200 /usr/local/www/nextcloud/status.php 23.094 2816 101.49%
127.0.0.1 - 17/Jul/2016:13:44:20 +0200 “PROPFIND /remote.php/webdav/” 404 /usr/local/www/nextcloud/remote.php 14.873 3072 105.06%

`
it seems that the PROFIND give a 404, maybe the problem is related to this?

The problem is definitly related to a problem in apache 2.4.23. I switched now to nginx and everything works again.

Hi,

I’ve also got a problem with an infinite redirect. No problems with the login page though. But I do have problems with
sharing links, at least if a Cookie-header is specified by the browser/client. If a Cookie-header is specified I get a Location-header which points to the exact same share link that should be showing in the browser. If it is not specified then the file is transferred correctly.

I don’t know if it is related somehow. Or maybe I should open a new topic for this? Have been tinkering for a while now trying to get it sorted out. But no luck…

I ran into the same issue after upgrading from Apache 2.4.12 to Apache 2.4.23. I was able to resolve the issue by replacing the following line in my Apache configuration:

ProxyPassMatch ^/.*.php(/.*)?$ "unix:/var/run/php-fpm/owncloud.socket|fcgi://localhost/"

The new configuration looks as follows:

<FilesMatch "\.php$">
    SetHandler "proxy:unix:/var/run/php-fpm/owncloud.socket|fcgi://localhost/"
</FilesMatch>

For me it was the defaultapp configuration option that started calendar, which was disabled during update. After removing it, the redirects disappeared.

Hello denzery. TI do not have the link ProxyPassMatch … in my /etc/apache2/apache2.conf file. Am i looking in the wrong place? This redirect problem has been driving me nuts

Thank you very much! This was driving me nuts :slightly_smiling_face:

I upgraded apache to 2.4.25 on CentOS 7 and was using a RewriteRule for php-fpm, and had the exact same problem.