Possible bug: Missing X-Forwarded-For and X-Varnish headers (Varnish 2.1.5 64bit Linux)

Johnny Halfmoon jhalfmoon at milksnot.com
Thu Jan 5 13:40:38 CET 2012


On 12/14/2011 09:36 AM, Per Buer wrote:
> Hi Johnny,
>
> On Wed, Dec 14, 2011 at 12:16 AM, Johnny Halfmoon <jhalfmoon at milksnot.com <mailto:jhalfmoon at milksnot.com>> wrote:
>
>     Hi,
>
>     I have a problem with Varnish (2.1.5)  not adding 'X-Forwarded-For' and an 'X-Varnish' to a large portion of the backend requests it makes. 
>
>
> Typically this happens when people are piping requests and forget to set a Connection: close. So then the TCP socket stays open and the browsers keeps on talking to the backend. Is this what is going on with you?
>
> Per Buer, CEO

Hi,

A bit late, but I would like to update this thread by closing it correctly with a summary of the solution. This issue has been resolved very quickly and correctly by the Varnish support team, on the same day that the issue was reported. Thanks guys!

The problem was not caused by a bug in Varnish at all, but by 2 errors in my VCL files, which indeed, as Per suggested, led to pipe connections remaining open. This is what happened:

1. POST requests were accidentally being handled by pipe(). I completely missed this in the config, and was convinced pipe was not being used. This was my config:

if (    req.request != "GET"&&
         req.request != "HEAD"&&
         req.request != "PURGE") {
            return(pipe);
}

2. To add to this error, another config errror was causing whole groups of requests to be piped because piped requests were not being 'closed'. But I thought they were, so I was looking elsewhere for the solution. I happened to be a silly typo. I was doing this:

vcl_pipe() { set req.http.connection = "close"; }

which is wrong and instead I should have been doing this:

vcl_pipe() { set bereq.http.connection = "close"; }

So in the end, closing the pipe connections properly fixed the problem. Again, thanks for the great support you guys!

Cheers,

Johnny





More information about the varnish-misc mailing list