[squid-users] Multiple responses in cache objects

Amos Jeffries squid3 at treenet.co.nz
Mon Apr 23 14:20:18 UTC 2018


On 24/04/18 00:43, Tobias Wolter wrote:
> Cheers,
> 
> I'm having some pretty weird issues with a customer's squid
> installation - we're seeing multiple responses in a single cache
> object.
> 

Please note the:

> X-Transformed-From: HTTP/0.9

... in your example cached objects.

Squid should not be caching these. Which implies that a) you have some
config settings forcing things to cache when they are not supposed to,
and b) either upstream server or client is broken.


 * do you have any refresh_pattern rules forcing it to do so?

 * what version of Squid are you running?

 * have you tried the latest Squid version?
 there have been a few fixes in detection this protocol version for Squid-4.


> Sadly, this isn't a singular incident and seems to be happening more
> often recently. We've rolled back all changes since the date people
> first started noticing the issues, but it still hasn't helped.
> 
> This occasionally leads to e.g. fragged CSS files, which users see by
> the way of the stylesheet not working.
> 
> I'm currently out of debugging ideas. Aside from the rollback, we've
> thus far isolated it to the Squid; the Apache which is the originserver
> for this successfully returns the correct site.


Squid is apparently receiving HTTP/0.9 response objects (a raw data
stream of octets) not HTTP 1.0 or 1.1 objects (stream of messages with
specific start and end points to each message object).


How do you determine that "successful" for the server?
 using any tool that hides away the protocols octet-level format details
 (eg curl, wget, browser, etc) can hide the HTTP/0.9 oddity from view.

Locate the URL which was originally requested by the client. The first
line of the cache file should be a single byte representing the
request-method, then the URL in plain-text ending with newline (\n). Use
squidclient to fetch that URL directly from the server like so:

  squidclient -h example.com -p 80 -V "-" http://example.com/




This is what a normal HTTP/1.x response message is supposed to look like:

( from "squidclient -h example.com -p 80 /" )

"
HTTP/1.0 404 Not Found
Content-Type: text/html
Date: Mon, 23 Apr 2018 13:56:18 GMT
Server: ECS (oxr/837F)
Content-Length: 345
Connection: close

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<head>
		<title>404 - Not Found</title>
	</head>
	<body>
		<h1>404 - Not Found</h1>
	</body>
</html>
"

And this is what your cache file 000255F5 says Squid is receiving from
the upstream server (for the URL you should see in the very start of
that 000255F5 file):

"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">;
<html>
        <head>
                <script type="text/javascript">var contextPath =
'';</script>

                <script type="text/javascript"
src="/js/jquery-1.11.2.min.js"></script>
            <script type="text/javascript" src="/js/layer.js"></script>
                <script type="text/javascript"
src="/js/jquery.colorbox-1.5.15.min.js"></script>
                <script type="text/javascript"
src="/js/cookies.js"></script>
...
"

Amos


More information about the squid-users mailing list