Session issues when using Varnish

Bjørn Ruberg bjorn at
Wed Mar 16 15:15:04 CET 2011

On 03/16/2011 02:58 PM, Chris Bloom wrote:
> I have been investigating an issue on a client's website that is very
> peculiar. I have verified that the behavior is due to the instance of
> Varnish that Rackspace configured for us. However, I'm not sure if this
> constitutes a bug in Varnish or a configuration error. I'm hoping
> someone can verify it for me one way or the other.
> Here is the scenario: Some of our PHP pages are protected by way of
> verifying that certain session variables are set. If not, the user is
> sent to the login page. We have observed that on URLs in which there is
> a querystring, and when the last value of that querystring ends in
> ".jpg", ".jpeg", ".gif", or ".png", and when we have an iptable rule
> that routes requests from port 80 to Varnish, the session is reset
> completely. Oddly enough, no other extension seems to have this affect.

This *looks* like some general Varnish rule that removes any (session) 
cookies when the URL (including the query string) ends with jpg, jpeg 
etc. However, since you did not include the Varnish configuration or 
Varnish logs, you will only receive guesswork.

Your test file is of absolutely no value as long as you didn't
a) provide the real URL for remote diagnosis and/or
b) the VCL for local testing.

Without any information on the Varnish configuration, further requests 
for assistance should be directed to your provider. You need someone 
with access to the VCL to be able to confirm your issue. The symptoms 
should be sufficiently descriptive, as long as they reach someone who 
can do anything about it. We can't.

Good luck,


More information about the varnish-misc mailing list