Hi,

Here is the post I have added on discourse about the issue with httpchk
POST request, which you can find at,
https://discourse.haproxy.org/t/httpchk-post-adding-connection-close-after-data/1875
The
content of the post is,

===========

I have setup haproxy 1.7.8 with option httpchk for my backend servers and
have working GET requests.
But while configuring the POST request with json data, I am getting error
code 400.

Here is my check added in backend block,

option httpchk POST /myService/endpt HTTP/1.1\r\nContent-Type:\
application/json;charset=UTF-8\r\nContent-Length:\
169\r\n\r\n{\"inputs\":[{\"id\":1,\"productType\":\"productType\",\"productDescription\":\"productDescription\",\"metaDescription\":\"metaDescription\",\"metaTitle\":\"metaTitle\",\"rawxyz\":\"rawxyz\"}]}
http-check expect rstatus (2|3)[0-9][0-9]

After debugging with wireshark capture I came to know that, haproxy is
adding *\r\f"Connection: close"\r\f\r\f* at the end of the post json data.
>From this manual, https://www.haproxy.org/download/1.7/doc/configuration.txt,
I found that haproxy appends it if httpchk is combined with *http-check
expect*.
But it should be added to header fields and not after data.

This is causing packet parse failure, as it considering POST data as a part
of header and reporting extra CRLF in headers.

[image: image]
image.png765x161 32.2 KB
<https://discourse-cdn-sjc1.com/business/uploads/haproxy/original/1X/99bf68d48ab6538ba29d14a88307daa7b50c694f.png>

I would need the http-check expect block to verify error code, but then how
would I avoid adding *Connection: close* at the end.

==========

>From the reply by lukastribus <https://discourse.haproxy.org/u/lukastribus>,
it seems to be due to the commit done with,
http://git.haproxy.org/?p=haproxy-1.7.git;a=commitdiff;h=32602d23610981b48143d1f82885b8cfae286e0f

How do we make sure that the Connection:Close field is added to headers and
not to POST body. Or finally I would have to uncomment that code and add
Connection:Close in headers in config only.

Thanks,

Rahul Ghanate

Reply via email to