PHOENIX-MEDIA / Magento-PageCache-powered-by-Varnish

Community version which is available on Magento Connect (http://www.magentocommerce.com/magento-connect/pagecache-powered-by-varnish.html)
89 stars 49 forks source link

Age = 0 #15

Closed maconeto closed 9 years ago

maconeto commented 9 years ago

My test server is this one http://176.111.193.53:8080/news.html After setup PageCache module and Varnish server following exactly what described in the document, I debug request header and see that:

Age 0 Cache-Control no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Connection keep-alive Content-Encoding gzip Content-Type text/html; charset=UTF-8 Date Wed, 22 Oct 2014 13:30:21 GMT Expires Mon, 31 Mar 2008 10:00:00 GMT Pragma no-cache Server Apache/2.2.15 (CentOS) Transfer-Encoding chunked Vary Accept-Encoding,User-Agent X-Cache-Debug 1 X-Cache-Doesi 1 X-Cache-Expires Mon, 31 Mar 2008 10:00:00 GMT X-Frame-Options SAMEORIGIN X-Powered-By PHP/5.4.32 X-Purge-Host 176.111.193.53:8080 X-Purge-URL /news.html X-Varnish 1421929504 via 1.1 varnish x-cache MISS

Rarely i have a HIT but yes i do have it sometimes. If i use Varnishstat i can see ratio is only ~0,2 - 0.4 i use Varnish version 3 , server centos, apache, php_mod, file default.vcl 3 in pagecache module

Using this website http://www.isvarnishworking.com/ it tells me age = 0 means Varnish is not actually serving the content for that url from cache. Is that right? What should i do?

In .htaccess file i have this Header set Cache-Control "max-age=691200, public, must-revalidate" but on frontpage i still see Cache-Control no-store, no-cache, must-revalidate, post-check=0, pre-check=0, how can i turn this off and should i do it?

i also see this cookie external_no_cache = 1

i installed this module Inovarti_FixAddToCartMage18.xml https://github.com/deivisonarthur/Inovarti_FixAddToCartMage18/blob/master/README.md

PHOENIX-MEDIA commented 9 years ago

"Vary Accept-Encoding,User-Agent" Check your Apache configuration (maybe .htaccess) and remove the "Vary User-Agent" header. It is a classic Varnish issue that this will lead to cache variants per User-Agent string...!

maconeto commented 9 years ago

Thanks. I have just done that, commented this in htaccess

Make sure proxies don't deliver the wrong content

Header append Vary User-Agent env=!dont-vary

but it doesn't fix the issue we are talking about. Do you have other suggestion to do?

PHOENIX-MEDIA commented 9 years ago

I see beautiful hits:

curl -I http://176.111.193.53:8080/news.html HTTP/1.1 200 OK Server: Apache/2.2.15 (CentOS) X-Powered-By: PHP/5.4.32 X-Frame-Options: SAMEORIGIN X-Cache-Debug: 1 X-Cache-Doesi: 1 Vary: Accept-Encoding Content-Type: text/html; charset=UTF-8 X-Purge-URL: /news.html X-Purge-Host: 176.111.193.53:8080 Date: Wed, 22 Oct 2014 14:39:02 GMT X-Varnish: 1960648355 1960648244 Via: 1.1 varnish Connection: keep-alive X-Cache: HIT X-Cache-Hits: 8 X-Cache-Expires: Mon, 31 Mar 2008 10:00:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Expires: Mon, 31 Mar 2008 10:00:00 GMT Age: 0

Neither does "Age: 0" say anything nor do you need the Inovarti_FixAddToCartMage18 module.

That said: This module is provided as is and we do not provide support for it on Github. If you need support please subscribe to the Enterprise version of our module http://www.magentocommerce.com/magento-connect/pagecache-powered-by-varnish.html.