HAProxy community

Set request method to POST and compute content-length

Hi Everyone, I am trying to do SSL termination for a web application that was incorrectly setup not to support HTTPS, problem is that I need to change one specific request from GET to POST but the end web application is expecting a Content-Length header otherwise outputs HTTP Status 411.

I did try to set Content-Length header but if length provided is too small I get HTTP 400 if the length provided is too big the request is stuck (obviously).

Would there be any way of computing that POST request Content-Length field and populate with set-header or add-header?

Thanks in advance.

If it would be trivial to compute content-length for the server (or intermediate proxy), we would not have to have it in the actual protocol as a requirement.

So no, there is no way to compute Content-Length trivially.

Hi, thank you for your reply, even if it’s not the one I wished for.