Jon Drukman wrote:
On Thu, Apr 10, 2008 at 6:36 AM, Amos Jeffries <[EMAIL PROTECTED]> wrote:
 >  Here you go:
 >
 >  # Listen on port 80,
 >  http_port 80 accel defaultsite=mysite.com vhost
 >
 >  # actual data source is 1.2.3.4
 >  # (IP or domain MUST NOT resolve to squid IP)
 >  cache_peer 1.2.3.4 parent 80 0 no-query originserver name=mySitePeer
 >
 >  # only accept requests for "mysite.com" or "www.mysite.com"
 >  acl mySites dstdomain mysite.com www.mysite.com
 >  cache_peer_access mySitePeer allow mySites
 >  http_access allow mySites
 >
 >  # stop random people abusing me with spam traffic.
 >  allow_direct deny all
 >  http_access deny all

i got an error on the "allow_direct" line so i commented it out.
right now this is all running on dev boxes behind a firewall so it's
no big deal about access control.

Sorry, typo on my part. I meant "always_direct deny all"


> > If I access the cache at it's IP address (http://10.0.2.19/) it does not
 > send the Host: mysite.com header back to the origin.  If I use curl to
> inject a Host: header into the request, it does work. I want it to always
 > inject that Host: header if it's missing.
 > >
 >
> It should be doing it. Try with the fixed config above. If you still see no
 > Host: I'll have a closer look at the code.

with the config above, i can't hit the squid server *without* the
header so it doesn't show the problem... but that's ok, i can live
with this.  it's not likely that real world clients will hit the squid
box without the right Host: header anyway.

This confuses me a little. You should be able to hit squid without it using the IP-address access you tried.

Okay. I checked the code quickly and it does appear to do a DNS lookup on the IP received and re-write the Host: header from the defaultsite if present or the DNS results if not.

The code also aborts that if a redirector fag is set saying:
"
 * Normally Squid rewrites the Host: header.
 * However, there is one case when we don't: If the URL
 * went through our redirector and the admin configured
 * 'redir_rewrites_host' to be off.
"


 > > Cache-Control: max-age=15, must-revalidate
 > > Content-Type: text/html; charset=UTF-8
 > >
 > > Squid is not obeying the Cache-Control though.  It always contacts the
 > origin on every request.
 >
 >  It should be.
> "must-revalidate" means contact the origin and check for new data. Try just
 > max-age alone.
 >
> And check that your server and squid machines are synced properly for time.
 > If they are out by 15sec that could cause this behavior.

They are in sync but it's still happening.

Well, this the kind of thing we now delve through the cache.log to track down why its refreshing.

Amos
--
Please use Squid 2.6.STABLE19 or 3.0.STABLE4

Reply via email to