Bug 236693 - www/nextcloud fresh installation from quarterly pkg causes redirect loop
Summary: www/nextcloud fresh installation from quarterly pkg causes redirect loop
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Many People
Assignee: Bernard Spil
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-21 07:19 UTC by Samuel Dowling
Modified: 2021-04-09 20:34 UTC (History)
3 users (show)

See Also:


Attachments
diff config.php 20.0.3 and 20.0.4 (1.14 KB, patch)
2021-03-01 10:51 UTC, Henrik Rosenke
no flags Details | Diff
revert pkg-plist patch from 20.0.4 (622 bytes, patch)
2021-03-01 12:25 UTC, Henrik Rosenke
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Samuel Dowling 2019-03-21 07:19:53 UTC
Overview:
When installing a new installation of www/nextcloud from the FreeBSD quarterly branch, this results in a redirect loop after the user selects "Finish Setup" at the web ui nextcloud setup screen.

Steps to reproduce:
1) Install www/nextcloud from quarterly branch
2) Configure required tech stack
3) Enter nextcloud configuration details in web ui
4) Select "Finish Setup"

Detailed steps to reproduce are available in a guide that I've written: https://www.samueldowling.com/2018/12/08/install-nextcloud-on-freenas-iocage-jail-with-hardened-security/

Bug is produced when user does not move from quarterly branch to latest branch of FreeBSD repository.

Actual Results:
User gets a redirect loop

Expected Results:
Successfully navigate to nextcloud web interface

Build Date & Hardware:
Bug first encountered in Nextcloud version 14.0.0
Build: 08/12/2018
Hardware:
 - FreeNAS 11.1 (FreeBSD 11.1 jail) 
 - Supermicro X9 SRi-F Motherboard
 - Samsung EVO 860 SSD
 - Intel Xeon E5-2660V2
Comment 1 Bernard Spil freebsd_committer 2019-03-21 09:13:40 UTC
Hi Samuel,

What is it redirecting to? (Developer view in browser or webserver logs should show)

Cheers, Bernard.
Comment 2 Samuel Dowling 2019-03-21 09:35:31 UTC
(In reply to Bernard Spil from comment #1)
Hi Bernard, 

Thanks for the quick reply. The error seems to be a continuous redirect - the error that I've had (In Firefox, at least, though similar in other browsers) is "The page isn’t redirecting properly. Firefox has detected that the server is redirecting the request for this address in a way that will never complete."

I've made the mistake of tearing my test instance down, so I'll spin another one up to answer your question and get back to you later. I've realised after submitting the bug report that I'd left out some detail however, so I'll add it here.

I originally experienced this issue when the quarterly branch was at 14.0.0, and the latest branch was at 14.0.1_1. It appears as though the patch to 14.0.1 was to fix the broken apps-pkg path in config.php. Since moving to the latest branch, I've had no issues whatsoever, but a number of people following my guide have reported the same issue I experienced when they stay on the quarterly branch.

One of these users reported today that their config.php configuration in nextcloud 15.0.0 didn't contain the ammendments to fix the broken apps-pkg path, which I suspect is the root of the issue, though I'm not sure.

If there's anything else you need let me know.

Cheers,

Sam
Comment 3 Samuel Dowling 2019-03-23 03:03:26 UTC
(In reply to Bernard Spil from comment #1)
Bernard,

The redirect is to /index.php/apps/files

Cheers,

Sam
Comment 4 Bernard Spil freebsd_committer 2020-07-24 18:56:44 UTC
This is so old now, can you confirm this still is the case?
Comment 5 Mark Kane 2021-02-27 02:40:51 UTC
Hi,

I am seeing this redirect loop issue as well on a fresh 12.2-RELEASE install, both quarterly or latest package branches. Nextcloud install is successful but immediately after logging in as the admin user there is a redirect loop to /index.php/apps/files/ 

The happens with nextcloud 20.0.4_1, 20.0.7, and 21.0.0 packages with PHP 7.4 and PHP 7.3.

If I install the nextcloud package to bring in all the dependencies, delete only the nextcloud package, and manually extract nextcloud-21.0.0.zip from upstream to the same /usr/local/www/nextcloud path with the same Apache and php-fpm configs everything works perfectly with no redirect loop. It's not clear why the redirect loop happens with the package but not when installed manually.

Thanks in advance.
Comment 6 Henrik Rosenke 2021-03-01 09:45:21 UTC
i can confirm this, i set this up via ansible and a shell script. 20.0.2 was no problem, tested 20.0.7 and 21.0.0 after this and it was not working.
After Installing via command line my config.php is missing the apps-pkg section for freebsd. After editing this after Installation there is no redirect but an internal server error. It seems its generating a wrong config.php with wrong app settings.
Comment 7 Henrik Rosenke 2021-03-01 10:51:08 UTC
Created attachment 222901 [details]
diff config.php 20.0.3 and 20.0.4
Comment 8 Henrik Rosenke 2021-03-01 12:25:23 UTC
Created attachment 222902 [details]
revert pkg-plist patch from 20.0.4

The Error seems to be in the change of the pkg-plist in the 20.0.4 update.
With the attached patch my setup with 20.0.4 and 21.0.0 is working like before and the config.php is right.

BTW, updating nextcloud instances wasnt a problem, an update from 20.0.2 to 20.0.7 went without problems, thats maybe why nobody noticed it that fast. To be honest i thought for a while its an error in my webserver config or something before stumbling upon this thread.

https://svnweb.freebsd.org/ports/head/www/nextcloud/pkg-plist?r1=557429&r2=558213&pathrev=558213
Comment 9 Neel Chauhan freebsd_committer 2021-04-04 02:02:52 UTC
This is also an issue when I had to reinstall Nextcloud today.
Comment 10 Henrik Rosenke 2021-04-09 20:34:52 UTC
(In reply to Neel Chauhan from comment #9)

Hello, 

did the attached patch fix the problem for you?