QUESTION: How can I trigger my C code and set variable in response header BUT still retain original Response body which server is generating for client.
Requirement: Write custom Apache module to read POST request body >> Take out data from request body >> Set particular response header attribute using request body >> Send response back to client
Details: I am using Apache as proxy for my ElasticSearch. I have successfully developed Apache Module in C and added it to httpd.conf. I have used "SetHandler" directive to trigger my custom C code.
It is all working fine. Request generated from client browser is going through my custom C Apache Module and in my C code, I am able to read POST request body from request_rec. I am also able to set response header with that value I am readying from request body.
Issue: If I invoke my module/code using SetHandler, when it comes out it does not have any response body and blank response body is sent to client browser. Where as when I disable my module/code, response is well generated a sent to client. So looks like by using SetHandler, response is lost.
My config/code are below: