6月 132012
 

Difficult to access the POST/GET/Cookie value in Varnish.
I want more easily to access it.
Therefore, I tried to make a VMOD to parse.

Feature

  • Support POST/GET request and Cookie header.
  • Support application/x-www-form-urlencoded and multipart/form-data Content-type in POST request.
  • Can be getting a list of key.
  • Support Varnish 3.0.1, 3.0.2 , 3.0.3-rc1

How to use

For example, how to set the response header from the POST key of hoge.
It’s a simple.


import parsereq;

vcl_recv{
  //please write "parsereq.init();" to 1st line in vcl_recv.
  parsereq.init();
}
vcl_deliver{
  set resp.http.hoge = parsereq.post_header("hoge");
}

Future plans

  • urlencode/decode
  • change the value and set to bereq
  • refactoring

I hope that this code is of help to you.

download here.
vmod-parsereq


  One Response to “To parsing the POST/GET request and Cookie header of Varnish (vmod-parsereq)”

  1. We like this!
    We are planning to submit a talk to hack.lu these days on the varnish security side of things. Hopefully the result will be a Varnish Security Firewall that includes and extends your work. Don’t know if you can make it but maybe we can collaborate before or after on a paper? Send us a mail to get in touch 😉

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください