title: HAProxy health check in tcp mode on https 404 status code
body: <p>I have two servers each running one Wildfly application server with one service available via https. The service is taking care of the https encryption. In front of the two servers I have an HAProxy as a load balancer in tcp mode to pass the ssl traffic through to the two services.</p>
  
  <p>The HAProxy health check only checks if the server is online, not the service. If the service is not running Wildfly returns:</p>
  
  <pre><code>&lt;html&gt;&lt;head&gt;&lt;title&gt;Error&lt;/title&gt;&lt;/head&gt;&lt;body&gt;404 - Not Found&lt;/body&gt;&lt;/html&gt;
  </code></pre>
  
  <p>which HAProxy interprets as healthy.</p>
  
  <p>HAProxy config:</p>
  
  <pre><code>global  
      maxconn 2000
  
  defaults
      log     global
      mode    http
      option  dontlognull
      retries 3
      option redispatch
      timeout connect  5000
      timeout client  10000
      timeout server  10000
  
  listen backend
      bind *:8443
      mode tcp
      balance roundrobin
      option httpclose
      server backend1 wildfly:8443 check
      server backend2 xxx.xxx.xxx.xxx:8443 check
  </code></pre>
  
  <p>How can I make HAProxy understand that <code>404 - Not Found</code> is <strong>not</strong> healthy.</p>