Haproxy 504 error



  • I have used haproxy to do reverse proxy for a lot of my web.

    I use vm to host websites, websites using ssl of cloudflare.
    Web sites with low traffic, I configured haproxy without any problem, everything works very well.
    There is only 1 high traffic site. I cannot successfully configure haproxy, cloudflare reports 504 errors.
    I switched over to the squid, all working normally.
    I don't know where I got it wrong.

    # Automaticaly generated, dont edit manually.
    # Generated on: 2019-03-29 02:21
    global
    	maxconn			1000
    	stats socket /tmp/haproxy.socket level admin 
    	gid			80
    	nbproc			1
    	hard-stop-after		15m
    	chroot				/tmp/haproxy_chroot
    	daemon
    	tune.ssl.default-dh-param	2048
    	server-state-file /tmp/haproxy_server_state
    
    listen HAProxyLocalStats
    	bind 127.0.0.1:2200 name localstats
    	mode http
    	stats enable
    	stats admin if TRUE
    	stats show-legends
    	stats uri /haproxy/haproxy_stats.php?haproxystats=1
    	timeout client 5000
    	timeout connect 5000
    	timeout server 5000
    
    frontend http-merged
    	bind			10.0.0.2:80 name 10.0.0.2:80   
    	mode			http
    	log			global
    	option			dontlognull
    	option			dontlog-normal
    	option			log-separate-errors
    	option			http-keep-alive
    	option			forwardfor
    	acl https ssl_fc
    	http-request set-header		X-Forwarded-Proto http if !https
    	http-request set-header		X-Forwarded-Proto https if https
    	timeout client		30000
    	acl			abc	var(txn.txnhost) -m sub -i abc.com
    	acl			abc1	var(txn.txnhost) -m sub -i abc1.com
    	http-request set-var(txn.txnhost) hdr(host)
    	http-request set-header X-Forwarded-Proto https  if  abc1 
    	use_backend abc_ipv4  if  abc 
    	use_backend abc1_ipv4  if  abc1 
    
    backend abc_ipv4
    	mode			http
    	id			10100
    	log			global
    	timeout connect		30000
    	timeout server		30000
    	retries			3
    	source ipv4@ usesrc clientip
    	server			litespeed 192.168.9.112:80 id 10101 check inter 1000  
    
    backend abc1_ipv4
    	mode			http
    	id			10110
    	log			global
    	timeout connect		30000
    	timeout server		30000
    	retries			3
    	source ipv4@ usesrc clientip
    	server			litespeed 192.168.13.119:80 id 10109 check inter 1000  
    
    


  • @admtpu
    Maybe try and increase the client and server timeouts from 30000 milliseconds to something longer.?



  • @PiBa Ok, I increased the time and it works well


Log in to reply