[squid-users] My cache gived me a content-length of 0, and a 200 TCP_REFRESH_UNMODIFIED_ABORTED
Amos Jeffries
squid3 at treenet.co.nz
Thu Feb 25 11:00:04 UTC 2021
On 25/02/21 4:45 am, Señor J Onion wrote:
> Thanks Amos - that’s a very kind and thorough explanation.
>
> Ok - I understand why the content-length is 0 as the server responded with a 304. Gotcha. Squid in response responds with a 200.
>
> And I also understand why it is a REFRESH because the server responded saying that it should not cache. (As a side note - I don’t understand what these directives do then: ignore-no-cache ignore-no-store ignore-must-revalidate ignore-private)
>
ignore-no-cache no longer exists, even in your old Squid version.
ignore-must-revalidate and ignore-auth were intended to help admin work
around caching issues in HTTP/1.0 traffic and during the early days of
the web's transition to HTTP/1.1. In latest Squid they no longer exist.
In your old version they are buggy to the point of being somewhat
dangerous. The ignore-auth is actively *preventing* things caching in
Squid-3.
ignore-no-store and ignore-private are for admin who think the bandwidth
saving of not having to transfer response bodies outweigh the risks of
hitting protocol issues - including the one you hit.
> What isn’t clear to me then is whether Squid actually returns the cached image? (content-length being 0).
>
There should be 0 bytes of payload/body/object in the 200 response Squid
delivers. But I'm not certain Squid is working correctly there
(dropping the cached object).
> The reason being, is that I am using Squid between my server and AWS S3 (or Google Storage)
>
> The first time I call my nodejs code to fetch the image from S3 (via the proxy) it works.
> The second time I call my nodejs code to fetch the image from S3, it fails. (Same Squid logs - instead of curl I am using nodejs code)
>
> My nodejs code fails with an HTTP Parse error (HPE_INVALID_CONSTANT). My guess is that the response from Squid is malformed. My guess is that the response is empty. Or that the image is in the response, but the content-length 0 causes the nodejs HTTP response parser to fail.
>
The response you presented earlier is fine. It is simply a 0-byte object
with the 200 status.
*IF* Squid is delivering the cached object, or any part of it along with
that Content-Length:0 header. Then the software receiving will be seeing
those bytes as if they were a second HTTP response message received -
and failing to parse it because actually an image.
Amos
More information about the squid-users
mailing list