HAProxy Cannot Connect to Backend (No Route to Host)

haproxy

I couldn't make the proxy work for one of our websites (IIS7). I am getting a "no route to host" message from the haproxy logs.

    Server test_be/10.100.1.1:81 is DOWN, reason: 
    Layer4 connection problem, info: "No route to host", 
    check duration: 1000ms. 0 active and 0 backup servers left. 
    0 sessions active, 0 requeued, 0 remaining in queue.

    backend test_be has no server available!

Here's what I found so far:

  • No firewalls are active in both machines.
  • ping, tracepath and telnet work.
  • Curl-ing from the haproxy machine is successful like: http://10.100.1.1:81/test.html returns value
  • haproxy frontend/backend config (does not work):

    frontend test
        bind 10.100.2.2:80
        mode http
        option httplog
        default_backend test_be
    
    backend test_be
        option httpchk
        balance source
        server s1 10.100.1.1:81 check port 81
    
  • haproxy alternative config (that works):

    listen test_direct
        bind 10.100.2.2:80
        mode tcp
        option tcplog
        balance source
        server s1 10.100.1.1:81
    
  • Other IIS website backends work as well.

Can you please help me understand why the frontend/backend setup doesn't work? I want to use it because I want to put additional rules based on requests coming in. Could it perhaps be due to health checks not being satisfied? (I actually don't know exactly how that happens.)

I'm splitting my hairs here.

Best Answer

Haproxy requests a valid return from the IIS server (http 200/300), in your case I am guessing it returns a 404 since a default index page does not exist. You may also want to add the url you wish to check (/test.html) to the httpchk config line.

Related Topic