Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
HAProxy bug with balance uri + option prefer-last-server + hash-type consistent
global
pidfile /tmp/haproxytest.pid
defaults
# we do web !
mode http
option httpchk /c
option http-keep-alive
option http-pretend-keepalive
listen test1
bind 127.0.0.1:8001
monitor-uri /c
errorfile 503 /tmp/test1.html
listen test2
bind 127.0.0.1:8002
monitor-uri /c
errorfile 503 /tmp/test2.html
listen test3
bind 127.0.0.1:8003
monitor-uri /c
errorfile 503 /tmp/test3.html
listen webtest:80
id 12
#balance source
hash-type consistent
option prefer-last-server
balance uri
bind 127.0.0.1:8000
maxconn 60000
server s1 127.0.0.1:8001 weight 5 check
server s2 127.0.0.1:8002 weight 5 check
server s3 127.0.0.1:8003 weight 5 check
HTTP/1.1 200 Found
Connection: keep-alive
Content-Type: text/plain
This is test1
HTTP/1.1 200 Found
Connection: keep-alive
Content-Type: text/plain
This is test2
HTTP/1.1 200 Found
Connection: keep-alive
Content-Type: text/plain
This is test3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.