[Varnish] #203: X-Forwarded-For handling

Varnish varnish-bugs at projects.linpro.no
Tue May 27 15:16:38 CEST 2008

#203: X-Forwarded-For handling
 Reporter:  des            |        Owner:  des     
     Type:  enhancement    |       Status:  assigned
 Priority:  normal         |    Milestone:          
Component:  documentation  |      Version:  trunk   
 Severity:  normal         |   Resolution:          
 Keywords:                 |  
Comment (by noah):

 Apache and many other proxies implement the non-standard X-Forward-For
 header with capital X and Fs.

 In varnish-cache/bin/varnishd/cache_http.c it reads
         http_PrintfHeader(sp->wrk, sp->fd, hp,
             "X-Forwarded-for: %s", sp->addr);
 Please consider changing -for to -For to help maintain compliance with
 already existing code that depend on the exact case of the header in
 (And yes, I'm aware that RFC 2616 says they should be case-insensitive -
 but still; )

 Arrays in PHP are case-sensitive and doing something like this won't work
 as expected:
   $headers = apache_request_headers();
   echo "XFF value: ". $headers["X-Forwarded-For"].

Ticket URL: <http://varnish.projects.linpro.no/ticket/203#comment:7>
Varnish <http://varnish.projects.linpro.no/>
The Varnish HTTP Accelerator

More information about the varnish-bugs mailing list