Search This Blog

Wednesday, April 10, 2013

How to simulate F5 health check requests with empty Host header

The curl tool is one of the tool you use on a daily basis when verifying and checking health checks on the F5 load balancer. But it has its limitations. One of these is that it don't insert an empty Host header.
 
# curl -v -H 'Host:' http://192.168.1.138 -o tmp
* About to connect() to 192.168.1.138 port 80
*   Trying 192.168.1.138... connected
* Connected to 192.168.1.138 (192.168.1.138) port 80
> GET /id.aspx HTTP/1.1
> User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
> Accept: */*
>

This simple command will use nc tool to initiate a TCP session and sent the whole HTTP request as you define it in the string between the quotes. That way we can simulate an empty Host header if we need it. For more option how to troubleshoot monitoring issue check this one https://devcentral.f5.com/wiki/advdesignconfig.TroubleshootingLtmMonitors.ashx.
 
$ echo -e "GET / HTTP/1.1\r\nHost:\r\nConnection: Close\r\n\r\n" | tee req.txt | nc -v 192.168.1.186 80
$ cat req.txt
GET / HTTP/1.1
Host:
Connection: Close

No comments:

Post a Comment