On 19/04/2013 8:00 p.m., Daniele Segato wrote:
Hi,
my need is to have Squid caching request to my server like this:
* do NOT bother the server more then once per minute to check if an
update is available
* if the server return a 500, go into timeout or something like this
during an update keep sending the cached resource to the user
Ideally I would like to be able to turn off the server for maintenance
while the Squid frontend keep returning request.
I've been trying to achieve this for a while now without success.
Is this possible?
Yes. These are both HTTP features.
Can you address me in the right direction?
The bit you are missing is the stale-* cache controls. See
http://www.mnot.net/blog/2007/12/12/stale
Squid supports stale-if-error since 3.2, but not yet
stale-while-revalidate. There is a bit more internal plumbing to be
created before that will work properly.
Thanks.
This is my configuration file (included in the main squid.conf):
Which currently cache updating every minute but start givin error
after that minute if the server is took down.
# http://wiki.squid-cache.org/SquidFaq/ReverseProxy
# http://www.visolve.com/squid/whitepapers/reverseproxy.php
#
http://www.howtoforge.com/how-to-set-up-a-caching-reverse-proxy-with-squid-2.6-on-debian-etch
#
http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch32_:_Controlling_Web_Access_with_Squid
http_port localhost:280 accel ignore-cc defaultsite=localhost
Ah the good old localhost. Nice to know you have installed a web server
there for all clients to access your website http://localhost/ with ...
cache_peer localhost parent 8080 0 no-query originserver no-digest
default name=myAccel
refresh_all_ims off
# IP address of web server
#httpd_accel_host 127.0.0.1
# Port of web server
#httpd_accel_port 8080
# Forward uncached requests to single host
#httpd_accel_single_host on
#httpd_accel_with_proxy on
#httpd_accel_uses_host_header off
The above are all config options from squid-2.5 an older. No time like
now to drop them completely.
acl Safe_ports port 280
http_access deny !Safe_ports
acl our_sites dstdomain 127.0.0.1 localhost mobc3.local
http_access allow our_sites
cache_peer_access myAccel allow our_sites
cache_peer_access myAccel deny all
<snip comments>
# cache services
refresh_pattern /alfresco/service/catalog 0 20% 4320
refresh_pattern /alfresco/service/stream 0 20% 4320
refresh_pattern /alfresco/service/news 0 20% 4320
# do not cache everything else
refresh_pattern . 0 20% 0
All of the values on refresh_pattern line has meaning and may be applied
independent of the other values. That 20% does something other than "do
not cache", so you probably want that to be "0%".
Amos