[Varnish] #1454: XFF is not handled in C

Varnish varnish-bugs at varnish-cache.org
Fri Aug 22 22:03:46 CEST 2014

#1454: XFF is not handled in C
 Reporter:  lkarsten  |       Owner:  tfheen
     Type:  defect    |      Status:  closed
 Priority:  normal    |   Milestone:  Varnish 4.0 release
Component:  varnishd  |     Version:  trunk
 Severity:  normal    |  Resolution:  fixed
 Keywords:            |

Comment (by eknkc):

 Replying to [comment:3 slink]:
 > You can still Modify XFF in VCL. C-Code only sets a default which you
 are free to delete or change.

 But this change basically hides the original XFF header from VCL. I have a
 similar situation where our varnish servers are behind Amazon's load
 balancer. We don't need or want the ELB's IP in XFF header.

 Anyway I added this to the vcl_recv to undo what Varnish does beforehand:

   if (req.restarts == 0 && req.http.x-forwarded-for) {
     set req.http.X-Forwarded-For = regsub(req.http.x-forwarded-for,
 "^(.*),([^,]+)$", "\1");

Ticket URL: <https://www.varnish-cache.org/trac/ticket/1454#comment:4>
Varnish <https://varnish-cache.org/>
The Varnish HTTP Accelerator

More information about the varnish-bugs mailing list