HAPROXY with IIS 7.5



  • Hi,

    I am using haproxy for load balancing IIS servers.

    backend Nameofbackend
        mode http
        balance roundrobin
        option forwardfor
        option httpchk HEAD / HTTP/1.0\r\nHost:localhost
        cookie SERVERID insert indirect nocache
        server HOSTNAME IPADDRESS:PORT check
        http-request set-header X-Forwarded-Port %[dst_port]
        http-request add-header X-Forwarded-Proto https if { ssl_fc }

    When I disable the tag option httpchk HEAD / HTTP/1.0\r\nHost:localhost, the url works fine

    But when we enable this it stops working.
    I need this tag for server health check. Can someone please help me with the correct configuration. Or I need to check something on IIS side?

    Any help will be appreciated. Thanks



  • Try changing:
    localhost to www.your.tld (the domain name you want the enduser visit)
    1.0 to 1.1
    HEAD to GET or OPTIONS



  • Hey PiBa,

    It worked perfectly
    Thanks a ton for your help man. You are awesome.

    But can you please tell me the options we changed what difference does it makes from current configuration.

    I am new to HAPROXY so want to understand difference

    HEAD and OPTIONS ?
    instead of localhost why we need domain name?



  • GET is the normal http command to request a webpage so pretty much always works. But does request the full body of the website, and could cause some overhead. When asking for OPTIONS the webserver does not need to try to serve up the complete webpage. Same for HEAD this should allow for less wasted processing time on the iis server. But not all web-servers support all HTTP commands.

    The 'localhost' it could be that the webserver is expecting the website/virtualhost requested before generating a valid reply, the expected requested domain name would surely not be localhost, not sure if that is the case for iis..



  • Thanks a lot dear for quick help.
    You made my weekend good :)


Log in to reply