Does not support underscore in host name?


#1

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

frontend http_proxy
        bind 0.0.0.0:80

        acl test hdr(host) -m str test_haproxy.mydomain.com
        use_backend test_server if test

backend test_server
        server 32828 10.254.99.34:32828 check

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


#2

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.


#3

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


#4

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