[squid-users] Fail and empty response instead cached resource

Amos Jeffries squid3 at treenet.co.nz
Tue Jan 21 11:54:51 UTC 2020


On 21/01/20 10:36 pm, Kuznetsov Sergei wrote:
> Hello
> 
> I run Squid 4.9 in non transparent mode with OPNsense (FreeBSD 
> 11.2-RELEASE-p16-HBSD FreeBSD 11.2-RELEASE-p16-HBSD 
> 87a7fc985c3(stable/19.7)  amd64).
> 
> Everything works except access to one website.
> 

Which is broken. More on that below...

> 
> When I make a request for the first time, everything is fine and I get 
> correct result.
> 
...
>> < HTTP/1.1 200 OK
>> < Server: nginx/1.4.6 (Ubuntu)
>> < Date: Tue, 21 Jan 2020 07:10:43 GMT
>> < Content-Type: text/javascript; charset=UTF-8
>> < Content-Length: 72175
>> < X-PaperRoute: Node
>> < ETag: "800439-72175-1534779018000"
>> < Last-Modified: Mon, 20 Aug 2018 15:30:18 GMT
>> < Access-Control-Allow-Origin: *
>> < Cache-Control: no-cache
>> < X-Cache: MISS from opnsense.lan
>> < X-Cache-Lookup: MISS from opnsense.lan:3128
>> < Via: 1.1 opnsense.lan (squid/4.9)
>> < Connection: keep-alive
>> <

The full object contains "Cache-Control: no-cache" which requires a
revalidate/refresh before the object can be used from cache.


> However, all subsequent requests fail and return an empty response.
> 


> Squid access log:
>
>> 2020/01/21 12:14:20     102 192.168.0.5
>> TCP_REFRESH_UNMODIFIED_ABORTED/200 65672 GET
>> http://tehspb.kodeks.ru/js/jquery-1.4.2.min.js -
>> HIER_DIRECT/5.61.15.55 text/javascript
>

... access.log indicates that Squid performed the revalidate (aka
refresh) on the content.


When the revalidation request is sent, the origin server updates the
HTTP headers to say that the object is now 0 bytes in length:

    HTTP/1.1 304 Not Modified
    Server: nginx/1.4.6 (Ubuntu)
    Date: Tue, 21 Jan 2020 11:27:17 GMT
    Content-Type: text/javascript; charset=UTF-8
=>  Content-Length: 0
    Connection: keep-alive
    X-PaperRoute: Node
    ETag: "800439-72175-1534779018000"
    last-modified: Mon, 20 Aug 2018 15:30:18 GMT
    Access-Control-Allow-Origin: *
    Cache-Control: no-cache


So Squid is relaying that change to the clients :

>> < HTTP/1.1 200 OK
>> < Server: nginx/1.4.6 (Ubuntu)
>> < Date: Tue, 21 Jan 2020 07:14:20 GMT
>> < Content-Type: text/javascript; charset=UTF-8
>> < Content-Length: 0

==> ^^

>> < X-PaperRoute: Node
>> < ETag: "800439-72175-1534779018000"
>> < Last-Modified: Mon, 20 Aug 2018 15:30:18 GMT
>> < Access-Control-Allow-Origin: *
>> < Cache-Control: no-cache
>> < Age: 0
>> < X-Cache: HIT from opnsense.lan
>> < X-Cache-Lookup: HIT from opnsense.lan:3128
>> < Via: 1.1 opnsense.lan (squid/4.9)
>> < Connection: keep-alive
>> <
>> * Excess found: excess = 986 url = /js/jquery-1.4.2.min.js 
>> (zero-length body)




Amos


More information about the squid-users mailing list