Socket.io behind HAProxy behind Google Cloud load balancer giving connection errors

We are trying to configure our Socket.io socket servers behind HAProxy and above HAProxy, we use Google Cloud Load Balancer, so HAProxy is not the only point of failure. As mentioned in this post https://medium.com/google-cloud/highly-available-websockets-on-google-cloud-c74b35ee20bc#.o6xxj5br8 . Also shown in the image below.

enter image description here

In the Google Google load balancer, we use TCP load balancing using an SSL proxy with the Proxy Protocol.

HAProxy Cookies, . cookie , source HAProxy. HAProxy

    log/dev/log local0     log/dev/log local1     chroot/var/lib/haproxy     stats socket/run/haproxy/admin.sock mode 660 admin      30     maxconn 16384     tune.ssl.default-dh-param 2048      haproxy      haproxy     

  # Default SSL material locations
  ca-base /etc/ssl/certs
  crt-base /etc/ssl/private

  # Default ciphers to use on SSL-enabled listening sockets.
  # For more information, see ciphers(1SSL). This list is from:
  #  https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/
  ssl-default-bind-ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS
  ssl-default-bind-options no-sslv3

defaults
  mode http
  log global
  option httplog
  option  http-server-close
  option  dontlognull
  option  redispatch
  option  contstats
  retries 3
  backlog 10000
  timeout client          25s
  timeout connect          5s
  timeout server          25s
  timeout tunnel        3600s
  timeout http-keep-alive  1s
  timeout http-request    15s
  timeout queue           30s
  timeout tarpit          60s
  default-server inter 3s rise 2 fall 3
  option forwardfor


frontend public
  bind *:443 ssl crt /etc/ssl/private/key.pem ca-file /etc/ssl/private/cert.crt accept-proxy
  maxconn 50000
  default_backend ws

backend ws
  timeout check 5000
  option tcp-check
  option log-health-checks
  balance source
  cookie QUIZIZZ_WS_COOKIE insert indirect nocache
  server ws1 socket-server-1:4000 maxconn 4096 weight 10 check rise 1 fall 3 check cookie ws1 port 4000
  server ws2 socket-server-1:4001 maxconn 4096 weight 10 check rise 1 fall 3 check cookie ws2 port 4001
  server ws3 socket-server-2:4000 maxconn 4096 weight 10 check rise 1 fall 3 check cookie ws3 port 4000
  server ws4 socket-server-2:4001 maxconn 4096 weight 10 check rise 1 fall 3 check cookie ws4 port 4001

, , 5% . ?

: , , socket.io .

.

+4

Source: https://habr.com/ru/post/1665486/


All Articles