Re: [squid-users] Apache 301 redirects working with squid

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Thu, 31 Dec 2009 17:34:08 +1300

Drew Wrobel wrote:
>
> I tried looking at the squid documentation and the board but I didn't find anything.
>
> As
> part of my Apache server configured, I have a mod_rewrite rule setup to
> do a 301 redirect for any URL that doesn't start with www.company.com.
>
> This
> was at the request of some end-users and because there are about 30 or
> do domains that we have that all server up the same content.
>
> The 301 redirect works fine with apache. I go to www-test.company.com and I get redirected to www.company.com as I expected.
>
> Now
> I need to get the 301 redirect to work with our squid caching servers.
> If I go to www-test.pepboys.com, I do not get redirected like I would
> going directly through Apache.
>
> Not sure what I need to change in the configuration to get the 301 redirects to work.
>
> Here
> the configuration from our non-production squid server (the only
> difference between production and non-production is the number of
> cache_peer entries):

You failed to specify what Squid version. I will assume you have one of
the current production releases numbered 2.6+ which are capable of doing
what you want.

>
> acl all src 0.0.0.0/0.0.0.0

acl all src all

> acl manager proto cache_object
> acl localhost src 127.0.0.1/255.255.255.255
> acl to_localhost dst 127.0.0.0/8

acl to_localhost dst 127.0.0.0/8 0.0.0.0/32

> acl SSL_ports port 443
> acl CONNECT method CONNECT
>
> hierarchy_stoplist cgi-bin ?
> acl QUERY urlpath_regex cgi-bin \?
> cache deny QUERY
> acl apache rep_header Server ^Apache
> broken_vary_encoding allow apache
> coredump_dir /var/cache/squid
> http_port 80 accel vport
> cache_peer 172.21.174.78 parent 80 0 no-query originserver round-robin login=PASS

Add these here:

  acl mainSite dstdomain www.company.com

  http_access allow mainSite
  cache_peer_access 172.21.174.78 allow mainSite
  cache_peer_access 172.21.174.78 deny all

  acl otherSites dstdomain .company.com

  deny_info http://www.company.com/ otherSites
  http_access deny otherSites
  http_access deny all

Drop all these:
> acl webserver dst 172.21.174.78
> http_access allow webserver
> http_access allow all
> miss_access allow webserver
> miss_access allow all
> http_access deny all

Amos

-- 
Please be using
   Current Stable Squid 2.7.STABLE7 or 3.0.STABLE20
   Current Beta Squid 3.1.0.15
Received on Thu Dec 31 2009 - 04:34:18 MST

This archive was generated by hypermail 2.2.0 : Thu Dec 31 2009 - 12:00:02 MST