High availablity setup using haproxy

Hi
I have trying create a nextcloud setup with high availablity access. Using haproxy. The setup at the moment is as follows

haproxy server infront of two web servers ( running linux, apache ). Web servers are connected to a nfs server, and a separate mysql server.

All the servers are running centos 7.

Haproxy is version 1.6
Apache web server is version 2.4.6
databse is mariadb version 5.5.47

The authentication method is ldap going to windows 2008r2 domain controllers

Everything works as it should when you connect to the invidual nextcloud server, but if you connect through the haproxy server it either produces a constant redirect loop error, or will not let you access the server using your logon details, or just reports its taking to long to connect.

Any help would be really helpful, as I have been trying to get this working for the last week

I have included the last few last few lines of the log file

{“reqId”:“V5Hx0DMi0ZcpqS8HMPaiXQAAAAs”,“remoteAddr”:“ip_address”,“app”:“user_ldap”,“message”:“Exception: {“Exception”:“Exception”,“Message”:“No user available for the given login name on ip_address1:3268”,“Code”:0,“Trace”:”#0 \/var\/www\/html\/nextcloud\/apps\/user_ldap\/lib\/User_LDAP.php(120): OCA\\User_LDAP\\User_LDAP->getLDAPUserByLoginName(‘admin’)\n#1 [internal function]: OCA\\User_LDAP\\User_LDAP->checkPassword(*** sensitive parameters replaced )\n#2 \/var\/www\/html\/nextcloud\/apps\/user_ldap\/lib\/User_Proxy.php(67): call_user_func_array(Array, Array)\n#3 \/var\/www\/html\/nextcloud\/apps\/user_ldap\/lib\/Proxy.php(139): OCA\\User_LDAP\\User_Proxy->walkBackends(‘admin’, ‘checkPassword’, Array)\n#4 \/var\/www\/html\/nextcloud\/apps\/user_ldap\/lib\/User_Proxy.php(182): OCA\\User_LDAP\\Proxy->handleRequest(‘admin’, ‘checkPassword’, Array)\n#5 \/var\/www\/html\/nextcloud\/lib\/private\/User\/Manager.php(190): OCA\\User_LDAP\\User_Proxy->checkPassword( sensitive parameters replaced )\n#6 \/var\/www\/html\/nextcloud\/lib\/private\/User\/Session.php(443): OC\\User\\Manager->checkPassword( sensitive parameters replaced )\n#7 \/var\/www\/html\/nextcloud\/lib\/private\/User\/Session.php(290): OC\\User\\Session->loginWithPassword( sensitive parameters replaced )\n#8 \/var\/www\/html\/nextcloud\/lib\/private\/User\/Session.php(323): OC\\User\\Session->login( sensitive parameters replaced )\n#9 \/var\/www\/html\/nextcloud\/lib\/private\/User\/Session.php(413): OC\\User\\Session->logClientIn( sensitive parameters replaced )\n#10 \/var\/www\/html\/nextcloud\/lib\/base.php(996): OC\\User\\Session->tryBasicAuthLogin(Object(OC\\AppFramework\\Http\\Request), Object(OC\\Security\\Bruteforce\\Throttler))\n#11 \/var\/www\/html\/nextcloud\/lib\/base.php(936): OC::handleLogin(Object(OC\\AppFramework\\Http\\Request))\n#12 \/var\/www\/html\/nextcloud\/index.php(39): OC::handleRequest()\n#13 {main}",“File”:"\/var\/www\/html\/nextcloud\/apps\/user_ldap\/lib\/User_LDAP.php",“Line”:104}",“level”:3,“time”:“2016-07-22T10:14:06+00:00”,“method”:“GET”,“url”:"/index.php/login",“user”:"–"}
{“reqId”:“V5Hx0DMi0ZcpqS8HMPaiXQAAAAs”,“remoteAddr”:“ip_address”,“app”:“user_ldap”,“message”:“Exception: {“Exception”:“Exception”,“Message”:“No user available for the given login name on ip_address2:3268”,“Code”:0,“Trace”:”#0 \/var\/www\/html\/nextcloud\/apps\/user_ldap\/lib\/User_LDAP.php(120): OCA\\User_LDAP\\User_LDAP->getLDAPUserByLoginName(‘admin’)\n#1 [internal function]: OCA\\User_LDAP\\User_LDAP->checkPassword(
sensitive parameters replaced )\n#2 \/var\/www\/html\/nextcloud\/apps\/user_ldap\/lib\/User_Proxy.php(67): call_user_func_array(Array, Array)\n#3 \/var\/www\/html\/nextcloud\/apps\/user_ldap\/lib\/Proxy.php(139): OCA\\User_LDAP\\User_Proxy->walkBackends(‘admin’, ‘checkPassword’, Array)\n#4 \/var\/www\/html\/nextcloud\/apps\/user_ldap\/lib\/User_Proxy.php(182): OCA\\User_LDAP\\Proxy->handleRequest(‘admin’, ‘checkPassword’, Array)\n#5 \/var\/www\/html\/nextcloud\/lib\/private\/User\/Manager.php(190): OCA\\User_LDAP\\User_Proxy->checkPassword( sensitive parameters replaced )\n#6 \/var\/www\/html\/nextcloud\/lib\/private\/User\/Session.php(443): OC\\User\\Manager->checkPassword( sensitive parameters replaced )\n#7 \/var\/www\/html\/nextcloud\/lib\/private\/User\/Session.php(290): OC\\User\\Session->loginWithPassword( sensitive parameters replaced )\n#8 \/var\/www\/html\/nextcloud\/lib\/private\/User\/Session.php(323): OC\\User\\Session->login( sensitive parameters replaced )\n#9 \/var\/www\/html\/nextcloud\/lib\/private\/User\/Session.php(413): OC\\User\\Session->logClientIn( sensitive parameters replaced )\n#10 \/var\/www\/html\/nextcloud\/lib\/base.php(996): OC\\User\\Session->tryBasicAuthLogin(Object(OC\\AppFramework\\Http\\Request), Object(OC\\Security\\Bruteforce\\Throttler))\n#11 \/var\/www\/html\/nextcloud\/lib\/base.php(936): OC::handleLogin(Object(OC\\AppFramework\\Http\\Request))\n#12 \/var\/www\/html\/nextcloud\/index.php(39): OC::handleRequest()\n#13 {main}",“File”:"\/var\/www\/html\/nextcloud\/apps\/user_ldap\/lib\/User_LDAP.php",“Line”:104}",“level”:3,“time”:“2016-07-22T10:14:07+00:00”,“method”:“GET”,“url”:"/index.php/login",“user”:"–"}
{“reqId”:“V5Hx0DMi0ZcpqS8HMPaiXQAAAAs”,“remoteAddr”:“ip_address”,“app”:“core”,“message”:“Login failed: ‘admin’ (Remote IP: ‘ip_address’)”,“level”:2,“time”:“2016-07-22T10:14:07+00:00”,“method”:“GET”,“url”:"/index.php/login",“user”:"–"}
{“reqId”:“V5Hx9AS1s1edQgN6xBEiGwAAAAs”,“remoteAddr”:“ip_address”,“app”:“user_ldap”,“message”:“Exception: {“Exception”:“Exception”,“Message”:“No user available for the given login name on ip_address1:3268”,“Code”:0,“Trace”:”#0 \/var\/www\/html\/nextcloud\/apps\/user_ldap\/lib\/User_LDAP.php(120): OCA\\User_LDAP\\User_LDAP->getLDAPUserByLoginName(‘admin’)\n#1 [internal function]: OCA\\User_LDAP\\User_LDAP->checkPassword(
sensitive parameters replaced )\n#2 \/var\/www\/html\/nextcloud\/apps\/user_ldap\/lib\/User_Proxy.php(67): call_user_func_array(Array, Array)\n#3 \/var\/www\/html\/nextcloud\/apps\/user_ldap\/lib\/Proxy.php(139): OCA\\User_LDAP\\User_Proxy->walkBackends(‘admin’, ‘checkPassword’, Array)\n#4 \/var\/www\/html\/nextcloud\/apps\/user_ldap\/lib\/User_Proxy.php(182): OCA\\User_LDAP\\Proxy->handleRequest(‘admin’, ‘checkPassword’, Array)\n#5 \/var\/www\/html\/nextcloud\/lib\/private\/User\/Manager.php(190): OCA\\User_LDAP\\User_Proxy->checkPassword( sensitive parameters replaced )\n#6 \/var\/www\/html\/nextcloud\/lib\/private\/User\/Session.php(443): OC\\User\\Manager->checkPassword( sensitive parameters replaced )\n#7 \/var\/www\/html\/nextcloud\/lib\/private\/User\/Session.php(290): OC\\User\\Session->loginWithPassword( sensitive parameters replaced )\n#8 \/var\/www\/html\/nextcloud\/lib\/private\/User\/Session.php(323): OC\\User\\Session->login( sensitive parameters replaced )\n#9 \/var\/www\/html\/nextcloud\/lib\/private\/User\/Session.php(413): OC\\User\\Session->logClientIn( sensitive parameters replaced ***)\n#10 \/var\/www\/html\/nextcloud\/lib\/base.php(996): OC\\User\\Session->tryBasicAuthLogin(Object(OC\\AppFramework\\Http\\Request), Object(OC\\Security\\Bruteforce\\Throttler))\n#11 \/var\/www\/html\/nextcloud\/lib\/base.php(936): OC::handleLogin(Object(OC\\AppFramework\\Http\\Request))\n#12 \/var\/www\/html\/nextcloud\/index.php(39): OC::handleRequest()\n#13 {main}",“File”:"\/var\/www\/html\/nextcloud\/apps\/user_ldap\/lib\/User_LDAP.php",“Line”:104}",“level”:3,“time”:“2016-07-22T10:14:43+00:00”,“method”:“GET”,“url”:"/index.php/core/js/oc.js?v=aa884628ab7753420be34542191c3d2b",“user”:"–"}

Can you share your ha-proxy configuration as well as the nextcloud-config-file? We can find an expert that can help you out then.

Hi. Sorry I have not updated this thread. However i have already found the issue. I had not configured ha-proxy correctly. When I added ’ cookie SRVNAME insert indirect nocache ’ to the haproxy config file.

1 Like

Thanks, I needed that!