danb35 / freenas-iocage-nextcloud

Script to create an iocage jail on FreeNAS for the latest Nextcloud 28 release, including Caddy, MariaDB or PostgreSQL, and Let's Encrypt
GNU General Public License v3.0
258 stars 71 forks source link

Spinning disc on login. Cannot login on mobile app. #102

Closed basilhendroff closed 4 years ago

basilhendroff commented 4 years ago

Hello danb35,

Symptoms:

Using Google Chrome or Microsoft Edge to login to Nextcloud results in a spinning disc. A screen refresh is required to get past the login screen. This issue does not arise with Mozilla Firefox. A more serious issue is that a refresh is not possible with the Nextcloud mobile app (tested on Android only) so login is not possible.

The Cause

The reason is described in this issue Redirecting bug since 15.0.2. I believe it has something to do with being behind a reverse proxy.

Suggested (untested) code

Having a look at your code, I believe these lines (untested)...

  iocage exec "${JAIL_NAME}" su -m www -c "php /usr/local/www/nextcloud/occ config:system:set overwritehost --value=\"${HOST_NAME}\""
  iocage exec "${JAIL_NAME}" su -m www -c "php /usr/local/www/nextcloud/occ config:system:set overwriteprotocol --value=\"https\""

...could be placed before this section...

if [ $NO_CERT -eq 1 ]; then
  iocage exec "${JAIL_NAME}" su -m www -c "php /usr/local/www/nextcloud/occ config:system:set overwrite.cli.url --value=\"http://${HOST_NAME}/\""
else
  iocage exec "${JAIL_NAME}" su -m www -c "php /usr/local/www/nextcloud/occ config:system:set overwrite.cli.url --value=\"https://${HOST_NAME}/\""
fi

Initially, I thought the overwriteprotocol value should be "http", because I had set up Nextcloud with NO_CERT=1 in the script config, but this didn't work for me when I used that value in config.php. It had to be "https". Now that could be because I separated out the Caddy function so I could put OnlyOffice behind Caddy as well. I'm not sure.

basilhendroff commented 4 years ago

Created my first ever pull-request!