Skip to content

Instantly share code, notes, and snippets.

@odoucet
Created December 27, 2016 16:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save odoucet/9409a175b8288a6198543b5a4ba3b400 to your computer and use it in GitHub Desktop.
Save odoucet/9409a175b8288a6198543b5a4ba3b400 to your computer and use it in GitHub Desktop.
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