[squid-users] offline mode not working for me

Amos Jeffries squid3 at treenet.co.nz
Thu Jan 18 16:24:34 UTC 2024


On 19/01/24 03:53, Robin Carlisle wrote:
> Hi, Hoping someone can help me with this issue that I have been 
> struggling with for days now.   I am setting up squid on an ubuntu PC to 
> forward HTTPS requests to an API and an s3 bucket under my control on 
> amazon AWS.  The reason I am setting up the proxy is two-fold...
> 
> 1) To reduce costs from AWS.
> 2) To provide content to the client on the ubuntu PC if there is a 
> networking issue somewhere in between the ubuntu PC and AWS.
> 
> Item 1 is going well so far.   Item 2 is not going well.   Setup details ...
> 
...

> 
> When network connectivity is BAD, I get errors and a cache MISS.   In 
> this test case I unplugged the ethernet cable from the back on the 
> ubuntu-pc ...
> 
> *# /var/log/squid/access.log*
> 1705588717.420     11 127.0.0.1 NONE_NONE/200 0 CONNECT 
> stuff.amazonaws.com:443 <http://stuff.amazonaws.com:443> - 
> HIER_DIRECT/3.135.162.228 <http://3.135.162.228> -
> 1705588717.420      0 127.0.0.1 NONE_NONE/503 4087 GET 
> https://stuff.amazonaws.com/api/v1/stuff/stuff.json 
> <https://stuff.amazonaws.com/api/v1/stuff/stuff.json> - HIER_NONE/- 
> text/html
> 
> *# extract from /usr/bin/proxy-test output*
> < HTTP/1.1 503 Service Unavailable
> < Server: squid/5.7
> < Mime-Version: 1.0
> < Date: Thu, 18 Jan 2024 14:38:37 GMT
> < Content-Type: text/html;charset=utf-8
> < Content-Length: 3692
> < X-Squid-Error: ERR_CONNECT_FAIL 101
> < Vary: Accept-Language
> < Content-Language: en
> < X-Cache: MISS from ubuntu-pc
> < X-Cache-Lookup: NONE from ubuntu-pc:3129
> < Via: 1.1 ubuntu-pc (squid/5.7)
> < Connection: close
> 
> I have also seen it error in a different way with a 502 but with the 
> same ultimate result.
> 
> My expectation/hope is that squid would return the cached object on any 
> network failure in between ubuntu-pc and the AWS endpoint - and continue 
> to return this cached object forever.   Is this something squid can do? 
>    It would seem that offline_mode should do this?
> 


FYI,  offline_mode is not a guarantee that a URL will always HIT. It is 
simply a form of "greedy" caching - where Squid will take actions to 
ensure that full-size objects are fetched whenever it lacks one, and 
serve things as stale HITs when a) it is not specifically prohibited, 
and b) a refresh/fetch is not working.


The URL you are testing with should meet your expected behaviour due to 
the "Cache-Control: public, stale-of-error" header alone.
   Regardless of offline_mode configuration.


That said, getting a 5xx response when there is an object already in 
cache seems like something is buggy to me.

A high level cache.log will be needed to figure out what is going on 
(see https://wiki.squid-cache.org/SquidFaq/BugReporting#full-debug-output).
Be aware this list does not permit large posts so please provide a link 
to download in your reply not attachment.


Cheers
Amos


More information about the squid-users mailing list