On Wed, Oct 6, 2010 at 6:54 PM, Amos Jeffries <squid3@xxxxxxxxxxxxx> wrote: > On 06/10/10 22:55, mohd hafiz wrote: >> >> ---------- Forwarded message ---------- >> From: mohd hafiz<bmhafiz@xxxxxxxxx> >> Date: Wed, Oct 6, 2010 at 5:17 PM >> Subject: Re: URL redirection in offline mode >> To: Amos Jeffries<squid3@xxxxxxxxxxxxx> >> >> >> thanks for fast respon, >> >> my squid will have to operate in network up and down. it will just do >> normal operation when the network is up. When the network is down, >> squid will intercept all request from client and point it to local >> server. i write a perl script to do the redirection. > > No need for that. redirect is automatic by prefer_direct. The local server > just needs to accept the random domains passed to it by Squid. > you means i did not need the perl script? i used the perl script in url_rewrite program /etc/squid/redirect.pl. >> i have configure my cache_peer to: >> >> cache_peer example.com 3128 3130 default > > example.com being your "local server". Is that another proxy or a web > server? The answer will determine whether you use port 3128/3130 or 80/0. > example.com is my web server >> >> and enable >> >> prefer_direct on >> >> but the browser still tried to reach the internet. it takes a few >> minutes to resolve to my local page. any advised? > > Are you doing WCCP, NAT interception or transparent proxy? > i'm doing transparent proxy > If yes, > the browser will be attempting and failing its own DNS to go direct to the > Internet Squid cannot help here. Connectivity failover with a proxy is not > easily compatible with interception. > is squid cannot function when the network is down? i know that squid will do a dns lookup at the startup. squid will not start if it fails dns lookup. i have tried to disable the internal dns lookup and still problem exists. is there any way to solve this? i also do a setup as below: i have write a shell script to ping the network and write the status to a text file. the perl script will read the text file and do the redirection based on the output from the text file. > If no, > Squid should be receiving an ICMP message from your router or its own > outgoing NIC indicating the Internet is unavailable. If that is not > happening you need to fix it. > > connect_timeout value can be tuned to adjust the time Squid waits before > attempting the peer. Squid will try connect_timeout (1 minute) for each IP > of the website before attempting another route. > > dns_timeout may also help if your DNS server is taking too long when the > network is down. Default there is 2 minutes. > > Amos > -- > Please be using > Current Stable Squid 2.7.STABLE9 or 3.1.8 > Beta testers wanted for 3.2.0.2 > thanks, hafiz