Hi
I need some assistance with my varnish (or at least so it seems like), for whatever reason whenever I use curl to check for varnish's "X-Varnish-Cache" I always get "MISS", I'm not sure when/what have changed in the past so it stop working but a while ago it was working fine no problem.
I post my varnish's default.vcl here: http://pastebin.com/6yJALh5B
any suggestions are welcome and not to just MISS/HIT but in general if you have any suggestions over my varnish config I'm gladly listen
mbp:~ alexus$ curl -I XXX.XXX
HTTP/1.1 200 OK
Server: Apache/2.2.15 (Red Hat)
X-Powered-By: PHP/5.3.3
Cache-Control: no-store, no-cache, must-revalidate, max-age=0
Last-Modified: Tue, 23 Aug 2011 11:23:03 +0000
Expires: Sun, 11 Mar 1984 12:00:00 GMT
Vary: Cookie,Accept-Encoding
Pragma: no-cache
Content-Type: text/html; charset=utf-8
Date: Tue, 23 Aug 2011 11:23:05 GMT
X-Varnish: 429498035
Age: 0
Via: 1.1 varnish
Connection: keep-alive
X-Varnish-Cache: MISS
mbp:~ alexus$
Thanks in advance
Comments
max-age=0
max-age=0 means don't let pages age.
You need to change your setting in pressflow in admin/settings/performance to allow pages to have an age. ;)
https://pantheon.io | http://www.chapterthree.com | https://www.outlandishjosh.com
Caching mode: set to External
Caching mode: set to External (experts only, possible side effects)
Minimum cache lifetime: none
Page cache maximum age: 30 min
Page compression: Enabled
Block cache: Enabled
Optimize CSS files: Enabled
Optimize JavaScript files: Enabled
that part haven't been changed in a while...
alexus.org && alexus.biz
Headers are what they are
I can't comment on your codebase or config since I can't see them, but the reason you're not getting caches is that the max-age header being sent is zero.
That's generally determined by the "Page cache maximum age" value in Pressflow, but you'll need to trace why that's not working. Find out where the header is being set and you'll have your answer.
https://pantheon.io | http://www.chapterthree.com | https://www.outlandishjosh.com
I'm not sure where to look
I went ahead and modify my /etc/hosts by pointing directly to our apache servers vs going through varnish and looks like I get same "max-age=0"
[alexus@wcmisdlin02 ~]$ curl -I XXX.XXX
HTTP/1.1 200 OK
Date: Tue, 23 Aug 2011 13:11:41 GMT
Server: Apache/2.2.15 (Red Hat)
X-Powered-By: PHP/5.3.3
Cache-Control: no-store, no-cache, must-revalidate, max-age=0
Last-Modified: Tue, 23 Aug 2011 13:11:41 +0000
Expires: Sun, 11 Mar 1984 12:00:00 GMT
Vary: Cookie,Accept-Encoding
Pragma: no-cache
Connection: close
Content-Type: text/html; charset=utf-8
[alexus@wcmisdlin02 ~]$ curl -I XXX.XXX
HTTP/1.1 200 OK
Date: Tue, 23 Aug 2011 17:11:53 GMT
Server: Apache
X-Powered-By: PHP/5.2.17
Cache-Control: no-store, no-cache, must-revalidate, max-age=0
Last-Modified: Tue, 23 Aug 2011 17:11:53 +0000
Expires: Sun, 11 Mar 1984 12:00:00 GMT
Vary: Cookie,Accept-Encoding
Pragma: no-cache
Connection: close
Content-Type: text/html; charset=utf-8
[alexus@wcmisdlin02 ~]$
so it looks like it's not varnish after all, but rather drupal causing this
alexus.org && alexus.biz
I found a problem inside of
I found a problem inside of httpd.conf that would prevent this from happening so as soon as i disabled everything went back to normal... whem :-)
alexus.org && alexus.biz
I'm really interested in this
I'm really interested in this issue too
Can you please describe the
Can you please describe the issue you found in apache and outline steps you took to correct it? Would be most helpful to others who might have the same issue with varnish / apache!
Warm regards!
Aruna
In my case settings.php
In my case settings.php configuration was causing the issue, changing the $conf['cache_lifetime'] to 0 did the trick.
Configuration that worked for me is below,
<?php
$conf['cache_backends'] = array('sites/all/modules/contrib/varnish/varnish.cache.inc');
$conf['cache_class_cache_page'] = 'VarnishCache';
$conf['page_cache_invoke_hooks'] = False;
$conf['reverse_proxy'] = True;
$conf['cache'] = 1;
$conf['cache_lifetime'] = 0;
$conf['page_cache_maximum_age'] = 21600;
$conf['reverse_proxy_header'] = 'HTTP_X_FORWARDED_FOR';
$conf['reverse_proxy_addresses'] = array('127.0.0.1');
$conf['omit_vary_cookie'] = True;
?>
Sivaji's solution worked for
Sivaji's solution worked for me too.
Appreciate it.
Narek
Las Vegas Web Design
Please note that removing the
Please note that removing the cookie will show anonymous cached pages for logged in users. If you have user specific content on pages, you will want to remove the following line:
$conf['omit_vary_cookie'] = True;