Holly
Holly

Reputation: 7752

Could something in my page http header be breaking varnish?

I've recently installed Varnish on our staging site with Magento Turpentine. I'm getting 0 hitrate in varnishstat.

Could this be something to do with my page headers? I have number of cookies in my request & response headers. For instance I have store, currency & cookielaw cookies, but when I disabled the Magento modules generating these so that only the typical Magento frontend cookie was set but this did not make any difference.

Status Code:200 OK
Request Headersview source
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding:gzip, deflate, sdch
Accept-Language:en-US,en;q=0.8
Authorization:Basic ZGV2aG9pOk5hc0RhdzEx
Cache-Control:max-age=0
Connection:keep-alive
Cookie:store=ie; adminhtml=6a879bc4bdd224727cbca06a5be87f4d; frontend=b6e7bcaa471baca15fba63417a44dad6; currency=EUR; adminhtml=6a879bc4bdd224727cbca06a5be87f4d; frontend=b6e7bcaa471baca15fba63417a44dad6; cookielaw=1
Host:staging-uat.example.com
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.95 Safari/537.36
Response Headersview source
Cache-Control:no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Connection:close
Content-Encoding:gzip
Content-Type:text/html; charset=UTF-8
Date:Mon, 14 Sep 2015 09:39:14 GMT
Expires:Thu, 19 Nov 1981 08:52:00 GMT
Pragma:no-cache
Server:nginx/1.4.6 (Ubuntu)
Set-Cookie:frontend=b6e7bcaa471baca15fba63417a44dad6; expires=Mon, 14-Sep-2015 10:39:13 GMT; Max-Age=3600; path=/; domain=staging.our-domain.ie
Transfer-Encoding:chunked
Vary:Accept-Encoding
X-Frame-Options:SAMEORIGIN
X-Powered-By:HHVM/3.9.0

Upvotes: 0

Views: 290

Answers (1)

Ronald
Ronald

Reputation: 2932

"Varnish will, in the default configuration, not cache a object coming from the backend with a Set-Cookie header present. Also, if the client sends a Cookie header, Varnish will bypass the cache and go directly to the backend."

See: https://www.varnish-cache.org/docs/3.0/tutorial/cookies.html

Upvotes: 1

Related Questions