Changeset 4467

Show
Ignore:
Timestamp:
18/01/10 14:30:47 (8 weeks ago)
Author:
phk
Message:

Produce the X-Forwarded-For: header in vcl_recv, so people can tweak
as they want.

Append to already existing header if possible.

NB: If you return early from your own vcl_recv, without pasting these
lines in top of your vcl_recv, your backend gets no X-F-F header.

Fixes #601
Fixes #540

Location:
trunk/varnish-cache/bin
Files:
1 added
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/varnish-cache/bin/varnishd/cache_http.c

    r4456 r4467  
    735735        http_FilterFields(sp->wrk, sp->fd, hp, sp->http, how); 
    736736        http_PrintfHeader(sp->wrk, sp->fd, hp, "X-Varnish: %u", sp->xid); 
    737         http_PrintfHeader(sp->wrk, sp->fd, hp, 
    738             "X-Forwarded-For: %s", sp->addr); 
    739737} 
    740738 
  • trunk/varnish-cache/bin/varnishd/default.vcl

    r4100 r4467  
    4141 
    4242sub vcl_recv { 
     43    if (req.http.x-forwarded-for) { 
     44        set req.http.X-Forwarded-For = 
     45            req.http.X-Forwarded-For ", " client.ip; 
     46    } else { 
     47        set req.http.X-Forwarded-For = client.ip; 
     48    } 
    4349    if (req.request != "GET" && 
    4450      req.request != "HEAD" &&