Behaving strange with timeout popups in nextcloud and reloading after setting up haproxy

I recently installed 2 instances of nextcloud with data on both nodes synced.
independently they work fine. but when I try to access them via haproxy node ip
I get 503 Gateway Time-out The server didn’t respond in time if I try to access via locally setup domain name. the locally set up domain name points to haproxy node ip

Also via haproxy I am having to sign in twice ! this is more of which is killing me.

also some
Nextcloud version (eg, 18.0.2):
Operating system and version (eg, Ubuntu 20.04): 18.04 /20.04
Apache or nginx version (eg, Apache 2.4.25): 2.4
PHP version (eg, 7.1): php 7.4

The issue you are facing:
504 Gateway Time-out The server didn’t respond in time. when trying to access via haproxy

Is this the first time you’ve seen this error? (Y/N): Y

This is my haproxy config

$ cat  /etc/haproxy/haproxy.cfg
    log local0 notice
    maxconn 4096
    chroot /var/lib/haproxy
    user haproxy
    group haproxy

    log     global
    mode    tcp
    option  tcplog
    option  dontlognull
    timeout connect 25s
    timeout client  25s
    timeout server  25s

listen http-in
    bind *:80
    mode http
    stats enable
    server nc1 check
    server nc2 check

but when I directly access each node it works fine.