Does not support underscore in host name?

I use haproxy 1.6. The haproxy cfg is as following:

frontend http_proxy

        acl test hdr(host) -m str
        use_backend test_server if test

backend test_server
        server 32828 check

Then I execute curl, it will response “400 Bad Request”. If I change to, curl will work well. Does haproxy not support underscore in host name? Thanks for the help!

HAProxy performs raw string matching with the ACL you chose.
To know why it returned a 400, you need to enable the stats socket and run a “show errors” over it.

How do you know its haproxy to generate the 400 Bad Request response? It could easily be your actual backend at

ISTR that support for underscores in hostnames is a bit vague in the TCP/IP RFCs.