Login to Nextcloud very very slow

Nextcloud version
Operating system : Redhat 7.2
Apache version : Apache/2.4.6 mod_php
PHP version : 7.3.17

Hello everybody,
i have a problem with my nextcloud instance (version
I have 3 servers (Rhel 7/php7.3/16Go RAM/2vCPU) loadbalanced behind an BIGIP-F5 (roundrobin mode with ssl offloading, X-FORWARD-FOR and X-FORWARD-PROTO SSL) with redis server and ldap authentication.
The login at the nextcloud web frontend lasts for over 1 minute.
I have already remove bruteforce protection without success.
But if i refresh the page without waiting for the redirect, I immediately access my files.
Has anyone ever had this problem?
Here my config.php

$CONFIG = array (
‘instanceid’ => ‘ocri0wnr1kdm’,
‘passwordsalt’ => ‘xxxx’,
‘secret’ => ‘xxxx’,
‘trusted_domains’ =>
array (
0 => ‘xxxx’,
‘datadirectory’ => ‘/var/www/html/nextcloud/data’,
‘dbtype’ => ‘mysql’,
‘version’ => ‘’,
‘overwrite.cli.url’ => ‘https://xxx’,
‘overwriteprotocol’ => ‘https’,
‘htaccess.RewriteBase’ => ‘/’,
‘auth.bruteforce.protection.enabled’ => false,
‘dbname’ => ‘nextcloud’,
‘dbhost’ => ‘DB-EXTERNAL-SERVER’,
‘dbport’ => ‘’,
‘dbtableprefix’ => ‘oc_’,
‘dbuser’ => ‘oc_admin’,
‘dbpassword’ => ‘DBPASS’,
‘logtimezone’ => ‘UTC’,
‘installed’ => true,
‘ldapIgnoreNamingRules’ => false,
‘ldapProviderFactory’ => ‘\OCA\User_LDAP\LDAPProviderFactory’,
‘maintenance’ => false,
‘mail_smtpmode’ => ‘smtp’,
‘updater.release.channel’ => ‘production’,
‘loglevel’ => 2,
‘theme’ => ‘’,
‘memcache.local’ => ‘\OC\Memcache\APCu’,
‘memcache.locking’ => ‘\OC\Memcache\Redis’,
‘memcache.distributed’ => ‘\OC\Memcache\Redis’,
‘filelocking.enabled’ => ‘true’,
‘redis’ =>
array (
‘host’ => ‘REDIS-SERVER’,
‘port’ => 6379,
‘mail_smtphost’ => ‘smtp.xxx’,
‘mail_sendmailmode’ => ‘smtp’,
‘mail_from_address’ => ‘nextcloud’,
‘mail_domain’ => ‘xx’,

Il have no error into httpd log files.
Thank you for your help

Nextcloud 15 is not maintained. Upgrade to a newer version.

Are you sure that this delay not caused by your LDAP?

Could be that it is some misconfiguration in Loadbalancer so that nextcloud answer could not hit you back. This could explain why you are logged in if you refresh the page.

Did you checked the web server logs?

Did you run network analyses on the browser to see what caused this delay? E.g. ctr+shift+e on FF or ctrl+shift+j on Chrome and then Network. Try to login and see what caused this delay.

Thank you for your answer. I tried this but without having any interesting information.
State : 303
Method : POst
File : login?clear=1

in delay : wait : 14,18s
other try


The waiting time is random. Sometimes it takes just 5 to 7 seconds to be connected.
Any ideas ?

303 is redirect with other reason. Basically this request should ended with 200 ok and main or requested page of nextcloud.


Something happens in ether your Load Balancer or reverse Proxy or web server (not sure about you config).

I believe it could be that roundrobin mode is the problem. Basically you have to search in direction session stickiness - when started session will not ended with a different instance of any application. Seems for BIGIP-F5 its called “session persistance”.
Otherwise you are waiting till your request is again ended up in a correct instance.

Thank you very much the community for your help.
I finally found the cause: resource problem on one of the servers. I’m very confused :frowning:
I also set up the sessions persistance, thank you @gas85.
I wish you a nice day

1 Like

Hello everyone,
I allow myself to reopen this thread because the problem reappeared. This time I think I have identified it: the avatar folder in data/appdata_ocxxx/avatar.
We have 40,000 accounts on our ldap and when the administrator want to manage users, the system creates avatars for all. So, with so many folders created, all connexions take a lot of time.
I tried to add ‘enable_avatars’ => false, in config.php without success.
I created a bash script to delete the avatar folders of users who have not yet logged in, but this is not a solution.
Any suggestions ? Thanks for your help

That strage… Should be solved in NC 12 https://github.com/nextcloud/server/pull/4214
So If you disable avatars and delete the folder they get generated anyway? May be you could open a ticket here: https://github.com/nextcloud/server/issues

yes it’s strange. I deleted the avatar folder and when I connect, it is recreated. However I have ‘enable_avatars’ => false, in the config.php :thinking:
I am thinking of upgrading the nextcloud version but I will soon encounter another problem. Up to version 16, you can modify the information on the login page, add links and other information. After v16, I don’t know how to do it