Redirect to site do not work correctly


#1

Hi at all,
First of all sorry for my English :grin: and i try to explain well my problem.
I compiled HAProxy (1.6.2 version) on a Debian OS (8.2) with Linux kernel 1.3.16.0-4-amd64.
I have a problem about haproxy configuration.
This is my haproxy file configuration:

global
	log /dev/log	local0
	log /dev/log	local1 notice 
	chroot /var/lib/haproxy
	stats socket /run/haproxy/admin.sock mode 660 level admin
	stats timeout 2m
	user root
	group root
	daemon
	ca-base /etc/ssl/certs
	crt-base /etc/ssl/private
	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
    	log	global
    	#log-format "%t %Ci %hr %f %Fi %b %Bi"
    	mode	http
    	option	httplog
    	option	dontlognull
    	timeout connect 5000
    	timeout client  50000
    	timeout server  50000
    	errorfile 400 /etc/haproxy/errors/400.http
    	errorfile 403 /etc/haproxy/errors/403.http
    	errorfile 408 /etc/haproxy/errors/408.http
    	errorfile 500 /etc/haproxy/errors/500.http
    	errorfile 502 /etc/haproxy/errors/502.http
    	errorfile 503 /etc/haproxy/errors/503.http
    	errorfile 504 /etc/haproxy/errors/504.http
    	maxconn  4096 
    	frontend IP_83_Sites
    		bind 192.168.100.83:80 transparent
    		log global
    		acl myportalvda hdr_sub(host) -i mysite.mycompany.it
    		use_backend goToGiotto if myportalvda
    		default_backend goToRaffello
    	backend goToRaffello
    	#	balance roundrobin 
    		option forwardfor
    		cookie LB_X_COOKIE_PER insert indirect nocache
    		source 0.0.0.0 usesrc clientip
    		server Raffello 192.168.1.6 check port 80 cookie sR
    	backend goToGiotto
    	#	balance roundrobin 
    		option forwardfor
    		cookie LB_X_COOKIE_PER insert indirect nocache
    		source 0.0.0.0 usesrc clientip
    		server Giotto 192.168.1.5 check port 80 cookie sG

The problem is that when i make a request to “mysite.mycompany.it” it doesn’t go always to the backend goToGiotto but some request is forwarderd to the goToRaffello backend.
Where is my mistake?


#2

Hi,

You don’t want to “redirect”, you want to “forward” the query to a backend, then to a server.
Could you also share the log lines corresponding to your tests?
Please also capture the Host header (capture request header Host len 32)