unknown transfer encoding HTTP error

Issue #831 resolved
Maksym Tiurin created an issue

In the last monit version 5.25.3 http headers check was added. Unfortunately, it’s broke services check using HTTP protocol.

Application to monitor - EJBCA. Config file is:

check process ejbca with matching "java .*jboss-modules.jar.*standalone.xml"
      group ejbca
      start program = "/etc/ejbca/run_ejbca start"
      stop program  = " /etc/ejbca/run_ejbca stop"
      restart program = "/etc/ejbca/run_ejbca restart"
      # JBoss management port
      if failed host port 9990 type TCP
         within 3 cycles then restart
      # EJBCA
      if failed URL
         within 3 cycles then restart
      # EJBCA SSL
      if failed host port 8443 type TCPSSL
        within 3 cycles then restart
      # EJBCA health check
      if failed URL
        content = "ALLOK"
        timeout 60 seconds
        within 5 cycles then alert
      if 5 restarts within 5 cycles then timeout
      mode manual

EJBCA health check doesn’t work in new release. Monit logs following error:

'ejbca' failed protocol test [HTTP] at []:8080/ejbca/publicweb/healthcheck/ejbcahealth [TCP/IP] -- HTTP error: uknown transfer encoding

EJBCA uses ‘chunked’ transfer encoding.

curl -v
* About to connect() to port 8080 (#0)
*   Trying
* Connected to ( port 8080 (#0)
> GET /ejbca/publicweb/healthcheck/ejbcahealth HTTP/1.1
> User-Agent: curl/7.29.0
> Host:
> Accept: */*
< HTTP/1.1 200 OK
< Server: Apache-Coyote/1.1
< Content-Type: text/plain;charset=ISO-8859-1
< Transfer-Encoding: chunked
< Date: Fri, 21 Jun 2019 01:21:56 GMT
* Connection #0 to host left intact

Please do transfer encoding check optional or add configuration parameter to extend allowed transfer encodings.

Comments (7)

  1. Tildeslash repo owner

    The Monit 5.25.3 has support for chunked encoding (no configuration is necessary) … please is it possible to test your http server remotely so we can try to reproduce?

    If remote access is not possible, please can you start monit in verbose mode (using -v option) and send us the log + collect a network trace (using for example wireshark)?

  2. Mario Aeby

    I just upgraded from 5.20 to

    ii  monit                                1:5.26.0-4                        amd64        utility for monitoring and managing daemons or similar programs

    and immediately started to receive the same alert:

    failed protocol test [HTTP] at []:4022/status/ [TCP/IP] -- HTTP error: unknown transfer encoding

    The monit check queries the mini webserver of udpxy:

    check host iptv-local.domain.local with address
        start program = "..."
        stop program = "..."
        if failed
            port 4022
            protocol http
            request "/status/"
            with content = "Cherenkov"
            for 5 cycles
        then restart

    Debugging the server response with cURL yields:

    $ curl -v
    *   Trying
    * TCP_NODELAY set
    * Connected to ( port 4022 (#0)
    > GET /status/ HTTP/1.1
    > Host:
    > User-Agent: curl/7.52.1
    > Accept: */*
    * HTTP 1.0, assume close after body
    < HTTP/1.0 200 OK
    < Content-type: text/html
    <style type="text/css">
    <div id="footer">udpxy v. 1.0 (Build 23) lean - [Sun Feb 23 10:46:18 2020]<br>udpxy and udpxrec are Copyright (C) 2008-2018 Pavel V. Cherenkov and licensed under GNU GPLv3</div>
    * Curl_http_done: called premature == 0
    * Closing connection 0


    • HTTP 1.0
    • No Content-Length: header

  3. Tildeslash repo owner

    Fixed: Issue #831: The HTTP protocol test returned "unknown transfer encoding HTTP error" in the case that the HTTP server didn't set the Content-Length nor used a chunked encoding for response.

    → <<cset 7e09bfbccb75>>

  4. Log in to comment