[squid-users] Supported configuration for adding origin server IP in response header

Amos Jeffries squid3 at treenet.co.nz
Thu Oct 16 19:40:52 UTC 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 17/10/2014 8:10 a.m., Darren Spruell wrote:
> Had a use case to ask about, apologies if I missed in docs. Is
> there a configuration that allows squid running as forward proxy to
> add a custom response header containing the origin server IP
> address that served the resource? Assuming no cache hierarchy.
> 
> In the event that the resource is served from cache, would be 
> interesting if squid were able to track the IP address from which
> the cached resource was originally retrieved to include in
> responses. In the event that's not possible, then the IP address of
> the cache itself as well as an indication that the resource was
> served from cache rather than an upstream origin.
> 
> Most resources seem to cover including this information in the
> access log, however I'm interested in having the data in the HTTP
> response for this case.
> 

IP address is not much useful in the response - any given machine has
multiple of those and they are also shared between anycast servers or
load balancers.

It is also a mistake to think of "the" server as being one machine. It
is becomming extremely popular to use CDN services these days. CDN are
reverse-proxy services in one form or another. So "the" server may be
a chain of servers on some path through a server farm.


1) The Via header is closest to what you are seeking. In responses it
contains each servers FQDN or an unique alias. It is supposed to
contain a record of the whole chain of machines the message traversed.
 - The problem is that a lot of admin disable it or strip it out of
the traffic. So you may get a proper chain or only what your proxy is
adding, with no easy way to identify missing chain data.


2) If the respone contains an Age: header then it has been cached.


3) Squid also adds X-Cache* headers indicating HIT/MISS status. But
those contain misinformation on REFRESH'd responses.

Amos

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (MingW32)

iQEcBAEBAgAGBQJUQB9EAAoJELJo5wb/XPRjoWsIANzZ03aSY1nHb6p9pDXGSKmu
4klFIaQSRi5VKQn2pbZljzxfoAO3Ev3sQBdbyoXzw14cv4EKXA9l5Jj+Q/XjG8Lh
ab07tcdordERsmH3iUmSpgOwRxvBoEI5HKqeKli4S37JjHOnZ+l/oU2MYZ2LTyJ7
pmnCWOJURjLlPBfEWCzh8eI6M1c5v56kS77qINapjK3qVqoc7UO5wYUTEm/S6iSX
EhmsIxrkCH4K3lZo74Krz4/sBcDViSZpfYE9SZeKlq9pakSH3uH4PU9Jw1qHYm6P
KE7clU+5DNMm6q0YR6z0GE0vw/8xFFrWkCCxXagRF0dOlbgIfE75w0nyy4k+jTg=
=s0Ul
-----END PGP SIGNATURE-----


More information about the squid-users mailing list