Use backend server based on past response status codes

Hello,
It is possible to use backend server based on response status codd in the past. For example domain example.com get error 403,503 on backend server 1.1.1.1 how can i tell haproxy to not use this server for this domain on future requests. Pls Help.

BR

Hello,

You have to use the health check. You can just use the default check or provide additional options to perform a custom check on specific url for example :

backend be_server
    option httpchk GET /httpchk HTTP/1.1
    http-check expect status 200
    server server01 127.0.0.1:8080 check

Ok thank you and i will map backend by domain name this config works only if target site is http.


  # ACL for "example.com" and "www.example.com"
  acl ACL_example.com hdr(host) -i example.com www.example.com
  use_backend be_example.com if ACL_example.com

  # ACL for "example.net"
  acl ACL_example.net hdr(host) -i example.net
  use_backend be_example.net if ACL_example.net

fallback every time default backend. But i will that it works on target https sites too. is there a way to map backend by domain name if targeting https sites too without configuring ssl cert. tried openssl on port 443 on 127.0.0.1 but get error self signed. What i want is
127.0.0.1:5555 —> map backend by domain —> backend for domain https://example.com pls help

Hello,

I really don’t understand what you are trying to do.

You want a http frontend with a https backend ? Are the user reaching you with http or https ?