POST x-forwarded-for

Alex F alex at acasa.ro
Thu Jun 24 10:45:00 CEST 2010


Hello,

I'm trying to make varnish forward the IP of the request to the backend.
While I have succeeded in doing so with GET requests, I cannot do the 
same with POST requests.
I have found the following link ( http://varnish-cache.org/ticket/203 ) 
which says:

"post mode is trickier. Assuming the request is an HTTP request, it is 
of course possible to add / modify X-Forwarded-For before entering post 
mode, but it won't be possible to modify subsequent requests on the same 
connection. This can be mitigated by also adding Connection: close to 
the request."

There is also a piece of VCL code:
if (bereq.http.x-forwarded-for) {
      set bereq.http.X-forwarded-for =
      bereq.http.X-forwarded-for ", "
      regsub(client.ip, ":.*", "");
      } else {
      set bereq.http.X-forwarded-for =
      regsub(client.ip, ":.*", "");
  }

But I cannot seem to convince varnish.
Please advise.





More information about the varnish-misc mailing list