Re: [squid-users] Domains without "www." - Probably silly question ....

From: James Sutherland <J.A.Sutherland@dont-contact.us>
Date: Thu, 11 Jan 2007 17:09:12 +0000

>>> On 11/01/2007 at 16:07, Jakob Curdes <jc@info-systems.de> wrote:

>>I am told that one way to restore the automated logics done by the
>>browser in finding the correct host name even when using a proxy is
to
>>use a proxy.pac file which depends on the IP of the destination
site.
>>You could try this, haven't verified myself.
>>
>>Not 100% sure how to do it but I suppose it's possible to detect the
>>lookup failure somehow and then return DIRECT from the pac..
>>
>>
> I could not find anything specific to this. Would it not be possible
to
> use a small URL rewriter that rewrites one-dot URL to its "www." form
?
> Sure this is a bad hack as it would not solve xyz.bogus.com or cope
with
> differente content in xyz.com and www.xyz.com but as far as I
understand
> Netscape's old doc on PAC syntax you can select different proxies or
go
> direct based on the URL but there is no way to tell the Browser to
> rewrite the URL itself - and going direct ist not an option; the
whole
> point of the proxy business was to shut down direct internet access
for
> the clients....

I think the trick here is to *tell* the browser to go direct - as long
as
it is allowed to perform DNS lookups, it will then get the DNS error
it
normally gets, and will try again for www.xyz.com instead - which goes
through the proxy as intended. The client never actually fetches
directly -
all it needs to do is make the attempt and fail, triggering the
'correction'
to www.* instead. All it needs for this is a working DNS server.

Simply putting this snippet in a PAC file should do:

function FindProxyForURL(url,host)
{
   if (isResolvable(host))
      return "PROXY myproxy:3128";
   else
      return "DIRECT";
}

should do the job you need: inaccessible addresses are tried directly
(and
fail, as they would anyway), everything else goes through the proxy.

James.
Received on Thu Jan 11 2007 - 10:10:38 MST

This archive was generated by hypermail pre-2.1.9 : Thu Feb 01 2007 - 12:00:01 MST