Symptoms

This happened right after the installation of ownCloud 5.0.13, when trying to log in for the first time. This failed, and the login page was simply served again (without any error message or explanation). The URL of that login page was then something like http://example.com/index.php?redirect_url=%2Findex.php%2Fapps%2Ffiles.

During installation, I also had to create an xcache admin user and password to solve the "xcache.admin.user and/or xcache.admin.pass settings is not configured" issue (for a description and instructions to solve it, see this tutorial).

However, this issue only happened when accessing the ownCloud installation from the same URL that was used for creating the admin user in the first place during installation. When using an alternative URL, like an IP based on available on most servers as http://xxx.xxx.xxx.xxx/owncloud/, login worked flawlessly (also reported here).

Solution

You have to disable xcache authentication again, and instruct your browser to forget the HTTP Basic authentication details that else get sent with every HTTP request header to the site's URL and trigger this issue again. Step by step:

  1. Go to the place in your php.ini or server admin panel where you configured the xcache authentication. It would look similar to this:

    [xcache.admin]
    xcache.admin.user = "admin"
    xcache.admin.pass = "798967d2527320febcf"

  2. Either add the line "xcache.admin.enable_auth = Off" or delete this whole section.
  3. Reconfigure or restart your web server (if not done by your server admin panel automatically). Depending on how your PHP gets served, it is usually one of these, on Debian and Ubuntu Linux at least:
    service apache2 reload;
    service php-fpm reload;
  4. Delete your HTTPBasic authentication details from your browser.
    • In Firefox, this is done by going to "Edit -> Preferences -> Clear your recent history -> Active Logins".
    • In Chrome, it can be done as shown here.
  5. You can confirm with a phpinfo() script, called from the ownCloud domain that would not work for login, that the HTTPBasic login details are no longer sent in HTTP headers for requests to this domain. Look for variable _SERVER[“HTTP_AUTHORIZATION”], the value should now be no value.

Discussion

  • The issue of the ownCloud login loop (with or without an actual redirect loop error message) is quite common and probably has multiple causes. If the above instructions did not help you, try some more solutions.
  • Maybe it is possible to use "xcache.admin.enable_auth = Off" during the initial ownCloud setup already, avoiding this whole maize. I did not try.
  • The issue seems to be ownCloud issue 4556, as esp. confirmed by this comment, showing the same solution.
  • Disabling HTTPBasic authentication for xcache is not a security issue because these login details are normally meant only for the xcache admin interface. So simply install this admin interface on a different virtual host, and enable HTTPBasic authentication over there.
  • This issue was not due to entering invalid login details for the ownCloud user; since when doing so deliberately, an error message would appear asking if one forgot the password.
  • The fact that the IP-based URL worked had nothing to do with webserver setup to handle the name-based URL [as assumed here]. Instead, it simply leads to using a different web server configuration, where xcache authentication had never been enabled. This happens for example in web server setups where you modify php.ini settings with snippets added per domain.

One thought on “How to fix the login loop in ownCloud?

Leave a reply

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>