I am currently working on a project based on varnish..
we write vcl
and vmod
. But the project needs to check the request body.
How can I get the post request body in VCL
or vmod
with a C function
?
You can do almost everything you want with VCL/VMOD.
You should try to call a VMOD subroutine in vcl_recv
, and then in C code, write something like below :
VRT_GetHdr(rec->s, HDR_REQ, "\017Content-Length:");
to read the body lengthHTC_Read(rec->s->htc, body, bodylen);
And enjoy !
You should take a look at existing vmods https://www.varnish-cache.org/vmods, and be free to look into the varnish API sources.
I'm not sure you can.
Varnish generally only deals with Req/Resp headers. The bodies are passed along without (much) modification.
I you do find a solution please let me know as I'm interested in this as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With