[squid-users] forwarding looping: acceptable for my config ?

From: Stuart Smith <stuart.smith@dont-contact.us>
Date: Mon, 7 Jan 2002 15:38:12 -0000

<LONG>

I'm using squid in a bit of a stange way, and just wanted to check
with everyone that what I am doing is:

1) dependable
2) not working simply because of a bug or undocumented feature
3) the best way to do what I want to do.

I am using Squid as a proxy for end users. However, for a certain subset
of the internet I have written another cache (which is ICP compliant) and
this serves that content. I want Squid to ALWAYS come to my cache for first.
If I say is an ICP_MISS, then I want squid to get it itself, otherwise if
I say it is an ICP_HIT (i.e. the subset of the internet my cache is managing)
then squid should come to me and get the content (but not cache it).

Also, the subset of the internet I am handling might change. When it does, and
I am now handing say cnn.com which I didn't before, I purge squid of all cnn.com
stuff. It then sends out its ICP_QUERYs again and gets an ICP_HIT next time.

So.. basically a sibling setup doesn't work, as sometimes squid gets things DIRECT
without asking me (for instance if the user does a refresh on their browser).

So I need to set squid up with me as a parent. However, I still want it to get
it for itself if I give it a ICP_MISS. If I just set it up with me as a parent,
it won't do that. It will still HTTP request the object from me, and expect to get
it. I don't want that.

So, I set it up as below:

cache_peer 127.0.0.1 parent 80 9999 proxy-only weight=1
cache_peer 127.0.0.1 parent 3128 3130 weight=2

Where squid is running on 3128/3130 and my proxy is running on the same box on 80/9999.

So, if my proxy is handling cnn.com for example...

Squid gets request for http://www.cnn.com. It sends out an ICP_QUERY to me AND to itself. It ALWAYS gets a hit from me, and therefore always gets a MISS from its other parent (itself).. as it never caches things I give it, and I never let it get it itself.

Since it got a hit from me, it only requests it from me, and gets it, and returns it to the user. All is fine.

Now... a request for something my proxy does not handle comes in (http://www.fish.com).

Squid gets request for http://www.fish.com. It sends out an ICP_QUERY to me AND to itself. It always a MISS from me, and may or maynot get a MISS from its parent (itself). If it gets a MISS, it HTTPs us both for the object. I just ignore the request (closing the stream), it then dtermines that it has a forwarding loop, and serves the request itself... which is what I wanted it to do.

This solution is 100% reliable at the moment.

So, my question is.. is having Squid as it's own parent in this way reliable with future versions ? i.e. is it defined behaviour that if it detects that an HTTP request has come from itself, that it realises that it is a loop, and does start sending out more ICP requests and looping for ever, but rather gets it from the source right there and then ??

If so, I'm happy.

If you've made it this far down this post thanks!

stu
Received on Mon Jan 07 2002 - 08:37:09 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 17:05:39 MST