[WAS]-Benny <(E-Mail Removed)> wrote:
> Hi people,
> We have a Squid proxy server set up for a few internal sites, but
> don't use it for external browsing. I want to link from a page to both
> proxied and non-proxied sites, withoout constantly changing the
> browser to proxy settings.
Just to clarify - you want some HTML in a web page to provide a
link to another page. But, you want that HTML to instruct the
browser to use the proxy for some links and not for others?
If I've interpreted that right, then AFAIK, there is no way for
a HTTP server to instruct a client to use a proxy or not. You have
to do proxy settings client side.
That said, you can get very close with a PAC script (see below).
> Is there a way to change the href to point to the proxy for certain
> and not for others. I believe this is more to do with the
> functionality of Squid, hence the post here...
I don't think this has much to do with Squid. A proxy server just
proxies. It can't decide whether it should be used or not! On the
other hand, if your browser is set to use the proxy for every
connection, the proxy can probably just fetch external sites
without caching them, but that doesn't appear to be what you are
after.
> ie;
> proxy server 1.1.1.1:111
> proxied address 2.2.2.2
> external www.xyz.com
> so the normal would be
> href=http://www.xyz.com
> then proxied
> href=http://1.1.1.1:111@2.2.2.2
Okay, try this concept: put a PAC (proxy automatic configuration)
script on your internal webserver so it is accessible at, says,
http://1.1.1.2/proxy.pac. Then, depending on your browser (Mozilla
based definately do PAC), you should be able to enter a PAC
location or an automatic configuration script URL for proxy
configuration. Use the proxy.pac address you have setup.
Then, in the proxy.pac file (which is just plain Javascript), use
somthing like this:
function FindProxyForURL(url, host)
{
if (isPlainHostName(host) ||
isInNet(host, "2.2.2.2", "255.255.255.0"))
return "DIRECT";
else
return "PROXY 1.1.1.1:111; DIRECT";
}
Now, when your client tries to fetch a URL, it will run the
FindProxyForURL script, and decide for itself whether to use the
proxy or bypass it and fetch the resource DIRECTly.
> Any ideas much appreciated.
Hope that helps!
Heath
--
*--------------------------------------------------------*
| ^Nothing is foolproof to a sufficiently talented fool^ |
| Heath Raftery, HRSoftWorks _\|/_ |
*______________________________________m_('.')_m__ _______*