--- nagios-plugins-1.4.12-orig/plugins/check_http.c 2008-05-07 12:02:42.000000000 +0200 +++ nagios-plugins-1.4.12-ommit-default-port/plugins/check_http.c 2008-09-02 10:32:30.000000000 +0200 @@ -753,7 +753,17 @@ /* optionally send the host header info */ if (host_name) - asprintf (&buf, "%sHost: %s:%d\r\n", buf, host_name, server_port); + { + /* Ommit the server port if it's the standard port (80 for http and 443 for https). */ + /* Some applications like wordpress do a redirect to a portless host if you named */ + /* a portnumber like www.wordpress-thingy.invalid:80. It will redirect to */ + /* www.wordpress-thingy.invalid and check_http adds the port number in the next */ + /* http call again resulting in a "redirection creates an infinite loop" */ + if ((use_ssl == false && server_port == HTTP_PORT) || (use_ssl == true && server_port == HTTPS_PORT)) + asprintf (&buf, "%sHost: %s\r\n", buf, host_name); + else + asprintf (&buf, "%sHost: %s:%d\r\n", buf, host_name, server_port); + } /* optionally send any other header tag */ if (http_opt_headers_count) {